@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #fff;
  --ink: #111110;
  --ink-2: #3d3c38;
  --muted: #6b6a64;
  --line: #e7e5de;
  --line-2: #cfcdc4;
  --soft: #f6f5f1;
  --accent: #d85a30;          /* acento decorativo (relleno, marcas) */
  --accent-strong: #c2461f;   /* acento para texto y botones: contraste AA con blanco */
  --radius: 10px;
  --nav-h: 60px;
  /* escala tipográfica: 16 / 18 / 22 / 28 / 40 */
  --t1: 1rem;
  --t2: 1.125rem;
  --t3: 1.375rem;
  --t4: 1.75rem;
  --t5: 2.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t1)/1.6 "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
@media (min-width: 720px) { body { padding-bottom: 0; } }

.wrap { max-width: 960px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 8px; }

a { color: var(--accent-strong); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: var(--t4); margin-top: 1.25rem; }
h2 { font-size: var(--t3); margin-top: 2rem; }
h3 { font-size: var(--t2); margin-top: 1rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: .25rem; }
main { padding-top: .5rem; padding-bottom: 3rem; min-height: 60vh; }
.lead { font-size: var(--t2); color: var(--ink-2); max-width: 65ch; }
.muted { color: var(--muted); }
.prose { max-width: 70ch; }
.crumb { margin: 1rem 0 0; color: var(--muted); }
.crumb a { color: var(--muted); }
.empty { padding: 1rem; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--ink-2); }

/* Cabecera y navegación: barra inferior en móvil, arriba en escritorio */
.top { border-bottom: 1px solid var(--line); background: var(--bg); }
.top-in { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
.brand { font-weight: 700; font-size: var(--t2); color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; min-width: 0; min-height: var(--nav-h); display: flex; align-items: center; justify-content: center; color: var(--ink-2); text-decoration: none; font-size: .875rem; border-top: 3px solid transparent; margin-top: -1px; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 650; border-top-color: var(--accent); }
@media (min-width: 720px) {
  .nav { position: static; border: 0; padding: 0; gap: 4px; }
  .nav a { flex: none; min-height: 44px; padding: 0 14px; font-size: var(--t1); border-top: 0; border-bottom: 3px solid transparent; margin: 0; }
  .nav a[aria-current="page"] { border-bottom-color: var(--accent); }
  .nav a:hover { color: var(--ink); }
  h1 { font-size: var(--t5); margin-top: 2rem; }
}

.foot { display: flex; flex-wrap: wrap; gap: 4px 20px; padding-top: 1.5rem; padding-bottom: 2rem; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border: 1px solid var(--accent-strong); border-radius: var(--radius);
  background: var(--accent-strong); color: #fff; font: 600 var(--t1)/1 "Geist", system-ui, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #a93a17; border-color: #a93a17; }
.btn-quiet { background: var(--bg); color: var(--ink); border-color: var(--line-2); }
.btn-quiet:hover { background: var(--soft); border-color: var(--ink-2); }
.btn-danger { background: var(--bg); color: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger:hover { background: #fdf1ec; border-color: var(--accent-strong); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 1.5rem 0; }
.actions form { margin: 0; }

/* Formularios */
.stack > * + * { margin-top: 1rem; }
.narrow { max-width: 420px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin-left: 0; margin-right: 0; min-width: 0; }
.field > label, legend { font-weight: 600; padding: 0; }
input, select, textarea {
  font: 400 var(--t1)/1.4 "Geist", system-ui, sans-serif; color: var(--ink);
  min-height: 48px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; width: 100%;
}
input:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--accent-strong); }
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--accent-strong); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; }
.inline { display: flex; gap: 10px; flex-wrap: wrap; }
.inline select { flex: 1 1 200px; width: auto; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1rem 0; }
.filters .grow { grid-column: 1 / -1; }
@media (min-width: 720px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr 1fr; } .filters .grow { grid-column: auto; } }

.notice { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--soft); margin: 1rem 0; }
.notice-error { border-color: var(--accent-strong); background: #fdf1ec; }
.notice-ok { border-color: var(--line-2); border-left: 4px solid var(--accent); }
.notice-secret { border-color: var(--ink); font-weight: 600; word-break: break-word; user-select: all; }

/* Inicio */
.hero { padding: 1.5rem 0 .5rem; }
.hero h1 { margin-top: 0; }
.search input { font-size: var(--t2); min-height: 56px; padding: 0 16px; border-radius: 12px; border-color: var(--ink); }
.results { list-style: none; padding: 0; margin: 8px 0 0; border: 1px solid var(--line); border-radius: var(--radius); }
.results li { margin: 0; }
.results a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; min-height: 48px; align-items: center; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.results li:last-child a { border-bottom: 0; }
.results a:hover, .results a:focus-visible { background: var(--soft); }
.big-links { display: grid; gap: 12px; margin: 1.5rem 0; }
.big-links a { display: flex; flex-direction: column; gap: 4px; padding: 20px; border: 1px solid var(--line-2); border-radius: 14px; color: var(--ink); text-decoration: none; }
.big-links strong { font-size: var(--t3); letter-spacing: -0.01em; }
.big-links span { color: var(--muted); }
.big-links a:hover { border-color: var(--accent); }
@media (min-width: 720px) { .big-links { grid-template-columns: repeat(3, 1fr); } .big-links a { min-height: 150px; } }

/* Listas de filas */
.rows { list-style: none; padding: 0; margin: 0 0 1rem; border-top: 1px solid var(--line); }
.rows li { margin: 0; border-bottom: 1px solid var(--line); }
.rows a { display: block; padding: 14px 0; min-height: 56px; color: var(--ink); text-decoration: none; }
.rows a:hover .row-main { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.rows.plain li { padding: 12px 0; }
.row-main { display: block; font-size: var(--t2); font-weight: 550; }
.row-meta { display: block; color: var(--muted); }
.row-form form { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.row-form .row-actions { display: flex; gap: 10px; align-items: center; }
.row-form select { width: auto; }
[hidden] { display: none !important; }

/* Ficha de ejercicio */
.illus-pending { display: block; width: fit-content; margin: .5rem auto; padding: .25rem .75rem; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 14px; }
.illus { display: block; width: 100%; max-width: 560px; height: auto; margin: 1rem auto; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; border-top: 1px solid var(--line); }
.facts div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 550; }
@media (min-width: 720px) { .facts { grid-template-columns: repeat(3, 1fr); } }
.prog { display: grid; grid-template-columns: 1fr; gap: 4px 16px; }
.prog-arrow { display: none; font-size: var(--t4); color: var(--accent); }
.prog ul { list-style: none; padding: 0; }
.prog li a { display: inline-flex; align-items: center; min-height: 44px; }
@media (min-width: 720px) { .prog { grid-template-columns: 1fr auto 1fr; } .prog-arrow { display: block; padding-top: 2.6rem; } }
.steps { padding-left: 1.5rem; }
.steps li { padding: 6px 0; }

/* Editor de rutinas */
.day { border-top: 1px solid var(--line); padding-top: .25rem; }
.day-head { display: flex; gap: 10px; align-items: center; margin-top: 1.25rem; }
.day-head input { font-weight: 650; font-size: var(--t2); }
.item { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.item-name { font-size: var(--t2); font-weight: 550; }
.item-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-self: start; }
.item-nums { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 16px; }
.num { display: flex; align-items: center; gap: 8px; }
.num input { width: 84px; text-align: center; }
.item .btn, .day-head .btn, .add-row .btn { min-height: 44px; padding: 0 14px; }
.add-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.add-row select { flex: 1 1 220px; width: auto; }
.more { margin: 1.5rem 0; border-top: 1px solid var(--line); padding-top: .5rem; }
.more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 650; font-size: var(--t2); }

/* Sesión de entreno */
.ex { padding: 1rem 0 .5rem; border-top: 1px solid var(--line); }
.ex h2 { margin: 0 0 .25rem; }
.ex h2 a { color: var(--ink); text-decoration: none; }
.sets { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.set { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border: 1px solid var(--line); border-radius: 12px; }
.set.is-done { background: var(--soft); border-color: var(--line-2); }
.set-n { width: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper input { width: 56px; text-align: center; padding: 8px 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper.kg input { width: 60px; }
.stepper .unit { color: var(--muted); margin-left: 2px; }
.step { width: 44px; height: 44px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); font: 500 var(--t3)/1 "Geist", sans-serif; cursor: pointer; }
.step:hover { background: var(--soft); }
.done { position: relative; margin-left: auto; width: 48px; height: 48px; display: block; cursor: pointer; }
.done input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tick { position: absolute; inset: 4px; border: 2px solid var(--ink-2); border-radius: 12px; background: #fff; }
.done input:checked ~ .tick { background: var(--accent-strong); border-color: var(--accent-strong); }
.done input:checked ~ .tick::after { content: ""; position: absolute; left: 13px; top: 5px; width: 8px; height: 15px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.done input:focus-visible ~ .tick { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.set.is-error { border-color: var(--accent-strong); }
.panel { margin: 1.5rem 0; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: 14px; }
.panel h2 { margin-top: 0; }
.rest { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--ink); color: #fff; }
.rest strong { font-size: var(--t3); font-variant-numeric: tabular-nums; }
.rest .btn-quiet { min-height: 44px; }
@media (min-width: 720px) { .rest { bottom: 0; } }
.timer-toggle { margin-top: 1rem; }

/* Tablas */
.table-wrap { overflow-x: auto; margin: 0 0 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { color: var(--muted); font-weight: 500; border-bottom-color: var(--line-2); }
tbody th { font-weight: 550; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.acts form { margin: 0; }
.acts .btn { min-height: 44px; padding: 0 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Huecos pendientes, bloques informativos y notas dentro del editor de rutinas */
.item-pending { border-left: 3px solid var(--accent); padding-left: 12px; }
.item-info { background: var(--soft); border-radius: var(--radius); padding: 12px; margin: 10px 0; border-bottom: 0; }
.item-info p, .item-pending p { margin: 4px 0 0; }
.item-note { grid-column: 1 / -1; margin: 0; }
.item .add-row { grid-column: 1 / -1; }
.item-name p { font-size: var(--t1); font-weight: 400; }
