:root {
  --bg: #f5f5f6;
  --panel: #ffffff;
  --linea: #ececef;
  --texto: #111111;
  --suave: #6b7280;
  --muted: #9aa0a9;
  --chip: #f0f0f2;
  --acento: #111111;
  --acento-texto: #ffffff;
  --aviso: #b7791f;
  --sombra: 0 2px 10px rgba(0, 0, 0, 0.07);
  --radio: 16px;
  /* Atlas Typewriter es de pago; se eligió Courier Prime (Google Fonts, pesos 400 y 700). Para cambiar de fuente, tocar aquí y el <link> de index.html */
  --fuente: "Courier Prime", "Courier New", ui-monospace, "SF Mono", Menlo, "Courier New", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; background: var(--bg); color: var(--texto); }
body {
  font: 17px/1.4 var(--fuente);
  padding: max(18px, env(safe-area-inset-top)) 16px calc(110px + env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
h1 { font-size: 26px; margin: 4px 0 4px; letter-spacing: -0.02em; }
p { margin: 0; }

.etiqueta { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--suave); margin: 24px 2px 8px; display: block; }
.panel .etiqueta { margin: 0; }
.atras { display: inline-block; color: var(--suave); padding: 8px 0; }
.plan, .sub, .mut { color: var(--suave); font-size: 14px; }
.error { color: #d64545; }
.negrita { font-weight: 600; }

/* ---------- inicio ---------- */
.cabecera { margin: 2px 2px 14px; }
.dia-semana { color: var(--suave); text-transform: capitalize; font-size: 15px; }
.fecha { font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }

.semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 14px; }
.dia { background: var(--panel); border-radius: 12px; box-shadow: var(--sombra); padding: 9px 0; text-align: center; min-width: 0; }
.dia b { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.dia span { display: block; font-size: 10.5px; margin-top: 2px; white-space: nowrap; letter-spacing: -0.02em; }
.dia.hoy { background: var(--acento); color: var(--acento-texto); }
.dia.hoy b { color: #c9ccd2; }

.caja { display: block; background: var(--panel); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; }
.caja + .caja { margin-top: 10px; }
.titulo-caja { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 2px 0; }
.boton { display: block; background: var(--acento); color: var(--acento-texto); text-align: center; border-radius: 13px; padding: 14px; font-weight: 600; margin-top: 14px; }
.boton:active { opacity: 0.85; }
.enlace { display: block; width: 100%; text-align: center; color: var(--suave); font-size: 14px; padding: 12px 0 0; }
.enlazada:active { opacity: 0.8; }
.fila-caja { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.lista-caja { padding: 4px 16px; }
.linea { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--linea); width: 100%; text-align: left; }
.linea:first-child { border-top: 0; }
.linea-nombre { flex: 1; min-width: 0; }
.linea-valor { color: var(--suave); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--chip); color: var(--suave); min-width: 58px; text-align: center; }
.tag.sube { background: var(--acento); color: var(--acento-texto); }
.boton-linea .linea-valor { font-size: 18px; color: var(--texto); }

.pila { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.pila .caja + .caja { margin-top: 0; }
.comp { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- listas y filas ---------- */
.lista { display: flex; flex-direction: column; gap: 8px; }
.fila {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; text-align: left; width: 100%;
  background: var(--panel); border-radius: var(--radio); box-shadow: var(--sombra); padding: 14px 16px;
}
.fila-titulo { font-weight: 600; }
.fila-detalle { color: var(--suave); text-align: right; font-variant-numeric: tabular-nums; }
.fila-sub { grid-column: 1 / -1; color: var(--suave); font-size: 13px; font-variant-numeric: tabular-nums; }
.check { position: absolute; right: 16px; bottom: 12px; font-weight: 700; }
.fila.hecho .fila-titulo { color: var(--suave); }

/* ---------- ejercicio ---------- */
.panel { background: var(--panel); border-radius: 20px; box-shadow: var(--sombra); padding: 16px; margin-top: 14px; }
.panel-fila { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.grande { font-size: 22px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.grande.acento { font-size: 20px; }
.separador { height: 1px; background: var(--linea); margin: 14px 0; }
.aviso { font-size: 12px; color: var(--aviso); }

.control { display: grid; grid-template-columns: 64px 1fr 64px; gap: 10px; align-items: center; margin: 10px 0; }
.paso { height: 64px; border-radius: 16px; background: var(--chip); font-size: 30px; }
.paso:active { background: #e3e3e7; }
.campo { text-align: center; }
.valor { font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.campo small { display: block; color: var(--suave); margin-top: -4px; }

.chips { display: flex; gap: 6px; }
.chip { min-width: 44px; height: 38px; padding: 0 12px; border-radius: 12px; background: var(--chip); color: var(--suave); }
.chip.activo { background: var(--acento); color: var(--acento-texto); font-weight: 600; }
.panel > .chips { margin-bottom: 14px; }

.principal { width: 100%; height: 60px; border-radius: 18px; background: var(--acento); color: var(--acento-texto); font-size: 18px; font-weight: 600; }
.principal:active { opacity: 0.85; }
.texto { color: var(--suave); font-size: 14px; }
.series { margin: 6px 0 0; padding: 0; list-style: none; counter-reset: s; }
.series li { counter-increment: s; display: flex; gap: 8px; padding: 8px 0; border-top: 1px solid var(--linea); font-variant-numeric: tabular-nums; }
.series li::before { content: counter(s); color: var(--suave); width: 28px; }
.series li > :first-child { margin-right: auto; }
.rpe { color: var(--suave); font-size: 14px; }

.navegacion { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.nav { color: var(--suave); padding: 12px 0; font-size: 14px; max-width: 48%; }
.nav.sig { color: var(--texto); text-align: right; margin-left: auto; }

.mini { height: 40px; padding: 0 14px; border-radius: 12px; background: var(--chip); }

/* ---------- formulario ---------- */
.formulario { display: flex; flex-direction: column; gap: 10px; }
.formulario input {
  height: 52px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--linea);
  background: #f7f7f8; color: var(--texto); font: inherit; font-size: 16px;
}
.formulario input:focus { outline: 2px solid var(--acento); outline-offset: 0; }
.formulario .error { font-size: 14px; }

/* ---------- sesión y ejercicio ---------- */
.barra { height: 4px; background: #e4e4e7; border-radius: 4px; margin: 8px 2px 14px; }
.barra i { display: block; height: 4px; background: var(--acento); border-radius: 4px; transition: width .3s; }
.pildora { font-size: 13px; color: var(--suave); background: var(--panel); border-radius: 999px; padding: 6px 14px; box-shadow: var(--sombra); }
.num { width: 24px; height: 24px; border-radius: 50%; background: var(--chip); color: var(--suave); font-size: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.num.ok { background: var(--acento); color: var(--acento-texto); }
.linea.hecho .linea-nombre { color: var(--suave); }
.paso { height: 56px; }
.control { grid-template-columns: 56px 1fr 56px; }
.valor { font-size: 40px; }

.ajustes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin: -2px 0 6px; }
.ajuste { height: 34px; border-radius: 10px; background: var(--chip); color: var(--suave); font-size: 12px; font-variant-numeric: tabular-nums; }
.ajuste:active { background: #e3e3e7; }

.peso-control { display: grid; grid-template-columns: 96px 1fr 96px; gap: 8px; align-items: center; margin: 10px 0; }
.columna { display: flex; flex-direction: column; gap: 8px; }
.salto { height: 54px; border-radius: 14px; background: var(--chip); color: var(--texto); font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.salto:active { background: #e3e3e7; }

.serie-actual { margin-top: 6px; font-size: 14px; font-weight: 600; }

/* ---------- tamaños de texto (Courier Prime se ve pequeña a igual tamaño) ---------- */
.etiqueta { font-size: 13px; }
.plan, .sub, .mut { font-size: 15px; }
.fila-sub { font-size: 14px; }
.dia-semana { font-size: 17px; }
.fecha { font-size: 34px; }
h1 { font-size: 28px; }
.titulo-caja { font-size: 30px; }
.dia b { font-size: 12px; }
.dia span { font-size: 11.5px; letter-spacing: -0.04em; }
.linea-nombre { font-size: 16px; }
.linea-valor { font-size: 15px; }
.tag { font-size: 12px; min-width: 64px; }
.boton { font-size: 17px; }
.enlace, .texto, .nav, .pildora, .atras { font-size: 15px; }
.serie-actual { font-size: 16px; }
.valor { font-size: 42px; }
.salto { font-size: 18px; }
.principal { font-size: 19px; }
.chip { font-size: 16px; }
.comp { font-size: 15px; }
.rpe { font-size: 15px; }
.aviso { font-size: 14px; }

.dos-lineas { flex-wrap: wrap; row-gap: 4px; }
.dos-lineas .linea-nombre { flex: 1 1 100%; }
.dos-lineas .linea-valor { flex: 1; }

/* ---------- pantalla de descanso (a pantalla completa) ---------- */
.principal { display: flex; align-items: center; justify-content: center; }
.descanso {
  position: fixed; inset: 0; z-index: 100; background: #fff;
  padding: max(24px, env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; justify-content: center; gap: 14px; overflow-y: auto;
}
.descanso > * { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; flex: none; }
.desc-etiqueta { text-align: center; color: var(--suave); font-size: 17px; }
.desc-tiempo { text-align: center; font-size: 88px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.descanso .barra { margin: 2px auto 8px; }
.desc-resumen { background: var(--bg); border-radius: 16px; padding: 14px 16px; }
.desc-ajustes { display: flex; gap: 10px; }
.desc-ajustes .mini { flex: 1; height: 54px; font-size: 18px; }
.descanso.listo { background: var(--acento); color: var(--acento-texto); }
.descanso.listo .desc-etiqueta, .descanso.listo .mut { color: #c9ccd2; }
.descanso.listo .desc-resumen { background: rgba(255, 255, 255, 0.1); }
.descanso.listo .mini { background: rgba(255, 255, 255, 0.16); color: #fff; }
.descanso.listo .barra { background: rgba(255, 255, 255, 0.2); }
.descanso.listo .barra i { background: #fff; }
.descanso.listo .principal { background: #fff; color: #111; }

/* =====================================================================
   PANTALLA FIJA: todo cabe en el alto del móvil, sin scroll ni zoom
   ===================================================================== */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; padding: 0; margin: 0; max-width: none; }
* { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input { -webkit-user-select: text; user-select: text; font-size: 16px; }

#vista {
  position: absolute; inset: 0; width: 100%; max-width: 560px; margin: 0 auto; overflow: hidden;
  padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.pantalla { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.pantalla > * { flex: none; }
.pantalla > .ajustable { flex: 1 1 0; min-height: 0; }
.pantalla .etiqueta { margin: 2px 2px -4px; }
.ajustable { display: flex; flex-direction: column; overflow: hidden; }

.pantalla .cabecera { margin: 0 2px; }
.fecha { font-size: 32px; }
.pantalla .caja { padding: 14px 16px; }
.pantalla .caja + .caja { margin-top: 0; }
.pantalla .titulo-caja { font-size: 28px; margin: 0; }
.pantalla .boton { margin-top: 10px; padding: 13px; }
.enlaces { display: flex; justify-content: space-between; gap: 8px; }
.enlaces .enlace { width: auto; padding: 10px 0 0; }
.pantalla > .enlace { padding: 4px 0; }
.dia { padding: 8px 0; }

/* filas de lista que se reparten el alto disponible */
.lista-caja { padding: 2px 14px; }
.mejora, .comp-fila {
  display: flex; align-items: center; gap: 8px; flex: 1 1 0; min-height: 30px; max-height: 62px;
  border-top: 1px solid var(--linea); font-size: 15px;
}
.mejora:first-child, .comp-fila:first-child { border-top: 0; }
.mej-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mej-val { color: var(--suave); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mejora.hecho .mej-nom { color: var(--suave); }
.mejora .tag { min-width: 56px; padding: 2px 6px; }
.comp-fila { flex-direction: column; align-items: stretch; justify-content: center; gap: 1px; max-height: 80px; }
.comp-fila .fila-caja { gap: 6px; }
.comp-l { font-size: 13px; color: var(--suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* pantalla del ejercicio */
.pantalla .barra { margin: 0 2px; }
.h1-ej { font-size: 24px; margin: 0; line-height: 1.15; }
.plan-ej { margin-top: -6px; }
.panel-ej { flex: 1 1 0; min-height: 0; margin: 0; padding: 12px 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.panel-ej .fila-caja { flex-wrap: wrap; row-gap: 0; }
.ult { font-size: 15px; }
.hechas { font-size: 13px; }
.serie-actual { margin: 0; }
.panel-ej .peso-control, .panel-ej .control { margin: 0; }
.panel-ej .control { grid-template-columns: 56px 1fr 56px; }
.salto { height: clamp(38px, 6dvh, 54px); }
.paso { height: clamp(42px, 6.6dvh, 56px); }
.valor { font-size: clamp(32px, 5.4dvh, 42px); }
.principal { height: clamp(48px, 7dvh, 60px); }
.rpe-fila { display: flex; align-items: center; gap: 10px; }
.rpe-fila .chips { flex: 1; }
.rpe-fila .chip { flex: 1; min-width: 0; padding: 0; height: clamp(34px, 5dvh, 42px); }
.panel-ej .enlace { padding: 0; margin-top: -2px; }

/* pantallas bajas (iPhone SE, mini): se compacta un poco más */
@media (max-height: 700px) {
  .plan-ej { display: none; }
  .fecha { font-size: 26px; }
  .pantalla .titulo-caja { font-size: 24px; }
  .pantalla .boton { padding: 10px; margin-top: 8px; }
  .pantalla { gap: 8px; }
  .panel-ej { gap: 4px; padding: 10px 12px; }
}
