/* Forja de Reclutas — pergamino, cuero, acero y verde de capa. */
:root {
  --bg: #e9dfc7; --bg-2: #dccfb0;
  --surface: #f5eedc; --surface-2: #ece2ca; --glass: rgba(245, 238, 220, .78);
  --ink: #231b13; --ink-2: #4f4131; --muted: #776750; --line: #cdbd98; --line-2: #b9a67c;
  --green: #2e4636; --green-2: #456b52; --on-green: #f5eedc;
  --leather: #6b4a2b; --red: #8b1e1e; --red-bg: #f1d9d2; --amber: #a86b12; --amber-bg: #f3e2bd;
  --ok: #3e6b4b; --ok-bg: #dbe6d4; --gold: #9c7a43;
  --fig: #b7a37b; --fig-2: #a08b62;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 6px 18px -8px rgba(60, 40, 15, .35);
  --r: 16px; --r-sm: 11px;
  --f-title: 'Cinzel', Georgia, serif;
  --f-num: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --top: calc(64px + env(safe-area-inset-top));
  --tab: calc(66px + env(safe-area-inset-bottom));
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #141817; --bg-2: #101312;
  --surface: #1f2522; --surface-2: #272e2a; --glass: rgba(26, 31, 29, .8);
  --ink: #eee5d1; --ink-2: #cdbfa3; --muted: #9a8e76; --line: #343d38; --line-2: #46514b;
  --green: #5a8a69; --green-2: #3f6a4e; --on-green: #10140f;
  --leather: #a8784a; --red: #e0614f; --red-bg: #3a1f1b; --amber: #e2a845; --amber-bg: #392d17;
  --ok: #7fb08c; --ok-bg: #1e2f24; --gold: #cfaa6c;
  --fig: #4c5651; --fig-2: #5d6862;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 8px 22px -10px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--f-body); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% -10%, transparent 40%, rgba(70, 45, 15, .10) 100%),
    radial-gradient(60% 40% at 15% 30%, rgba(255,255,255,.25), transparent 70%),
    var(--bg);
}
.bg::after {
  content: ""; position: absolute; inset: 0; opacity: .32; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .12 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .bg { background: radial-gradient(120% 70% at 50% -10%, rgba(90,138,105,.10), transparent 60%), var(--bg); }
:root[data-theme="dark"] .bg::after { mix-blend-mode: screen; opacity: .08; }

.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.h1 { font: 900 clamp(1.55rem, 6vw, 1.9rem)/1.15 var(--f-title); letter-spacing: .01em; margin: 6px 0 6px; }
.h2 { display: flex; align-items: center; gap: 8px; font: 700 1.12rem/1.2 var(--f-title); margin: 28px 0 12px; }
.h3 { font: 700 .82rem/1 var(--f-num); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }
.lead { color: var(--ink-2); margin: 0 0 16px; }
.hint { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
small { display: block; }

.glass { background: var(--glass); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); }

/* Barra superior */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: var(--top);
  padding: env(safe-area-inset-top) 16px 0; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: block; transition: transform .2s; }
.brand-mark.strike { animation: strike .5s ease; }
@keyframes strike { 30% { transform: rotate(-14deg) scale(1.1); } 60% { transform: rotate(6deg); } }
.brand-name { font: 900 1.02rem/1.1 var(--f-title); letter-spacing: .02em; }
.brand-sub { font: 600 .78rem/1.2 var(--f-num); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }

main { max-width: 540px; margin: 0 auto; padding: calc(var(--top) + 16px) 16px calc(var(--tab) + 28px); }
.view { display: none; }
.view.active { display: block; animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

/* Tarjetas */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; position: relative;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .card { margin: 0 0 12px; }

.rank-card { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: center; padding: 18px; overflow: hidden; }
.rank-card::before {
  content: ""; position: absolute; inset: 5px; border: 1.5px dashed var(--line-2); border-radius: 12px; pointer-events: none; opacity: .7;
}
.rank-card .shield-svg { width: 112px; height: auto; filter: drop-shadow(0 6px 10px rgba(40, 25, 10, .35)); }
.rank-kicker { font: 600 .78rem/1 var(--f-num); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.rank-name { font: 900 1.7rem/1.1 var(--f-title); margin: 4px 0 2px; }
.rank-mat { color: var(--ink-2); font-size: .9rem; }
.bar { height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin: 12px 0 6px; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--green-2), var(--green)); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.rank-next { font-size: .85rem; color: var(--muted); }

.stat-card { padding: 14px; }
.stat-label { display: flex; align-items: center; gap: 6px; font: 600 .8rem/1 var(--f-num); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat-label .i { width: 16px; height: 16px; }
.stat-big { font: 700 2.4rem/1 var(--f-num); margin: 10px 0 4px; }
.stat-foot { font-size: .82rem; color: var(--muted); }
.week-dots { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 8px; min-height: 26px; }
.week-dots i { width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--line-2); background: var(--surface-2); }
.week-dots i.on { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 3px var(--surface); }

.zones-card { display: flex; width: 100%; align-items: center; gap: 12px; text-align: left; cursor: pointer; }
.zones-card .i { width: 26px; height: 26px; color: var(--leather); }
.zones-card div { flex: 1; min-width: 0; }
.zones-card strong { display: block; }
.zones-card small { color: var(--muted); }
.zones-card .chev { width: 18px; height: 18px; color: var(--muted); }
.ztags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ztag { font: 600 .78rem/1 var(--f-body); padding: 5px 8px; border-radius: 99px; }
.ztag.st1 { background: var(--amber-bg); color: var(--amber); }
.ztag.st2 { background: var(--red-bg); color: var(--red); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 13px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer;
  font: 700 1rem/1 var(--f-body); text-decoration: none; color: var(--ink); position: relative; overflow: hidden;
  transition: transform .12s ease, box-shadow .2s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-wide { width: 100%; margin-top: 10px; }
.btn-primary {
  border: 0; color: var(--on-green);
  background: linear-gradient(180deg, var(--green-2), var(--green));
  box-shadow: 0 0 0 1.5px var(--green) , inset 0 0 0 2px rgba(245,238,220,.18), 0 8px 18px -8px rgba(30, 50, 35, .7);
}
.btn-primary::before {
  content: ""; position: absolute; inset: 4px; border: 1px dashed rgba(245, 238, 220, .35); border-radius: 9px; pointer-events: none;
}
.btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.22), transparent);
  animation: shimmer 4.5s ease-in-out infinite;
}
@keyframes shimmer { 0%, 70% { left: -60%; } 100% { left: 130%; } }
.btn-xl { width: 100%; min-height: 64px; font: 900 1.25rem/1 var(--f-title); letter-spacing: .04em; margin-top: 6px; }
.btn-xl .i { width: 24px; height: 24px; }
.btn-ghost { background: transparent; }
.btn-danger-ghost { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .18; animation: rip .55s ease-out forwards; pointer-events: none; }
@keyframes rip { to { transform: scale(2.6); opacity: 0; } }

/* Barra de pestañas */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--tab); padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: center; border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; cursor: pointer; color: var(--muted); font: 600 .74rem/1 var(--f-num); letter-spacing: .1em; text-transform: uppercase;
}
.tab .i { width: 24px; height: 24px; }
.tab.active { color: var(--green); }
.tab.active .i { stroke-width: 2.2; }

/* Escudos */
.shields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shield-tile { text-align: center; padding: 12px 6px 12px; margin: 0; }
.shield-tile .shield-svg { width: 74px; height: auto; display: block; margin: 0 auto 6px; filter: drop-shadow(0 4px 6px rgba(40,25,10,.3)); }
.shield-tile strong { display: block; font: 700 .95rem/1.15 var(--f-title); }
.shield-tile small { color: var(--muted); font-size: .76rem; margin-top: 2px; }
.shield-tile.locked .shield-svg { filter: grayscale(.4) opacity(.42); }
.shield-tile.current { border-color: var(--green); box-shadow: 0 0 0 2px var(--green), var(--shadow); }

.badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge { display: flex; gap: 10px; align-items: center; padding: 12px; margin: 0; }
.medal {
  width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #f6dc94, #b08d57 60%, #7a5a26); color: #3d2a0c;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.35), inset 0 -3px 5px rgba(0,0,0,.25), 0 3px 6px rgba(40,25,10,.3);
}
.medal .i { width: 22px; height: 22px; stroke-width: 2; }
.badge strong { display: block; font-size: .88rem; line-height: 1.2; }
.badge small { color: var(--muted); font-size: .76rem; line-height: 1.3; margin-top: 2px; }
.badge.locked .medal { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 2px var(--line-2); }
.badge.locked strong { color: var(--ink-2); }

.donate { margin-top: 24px; }
.donate-head { display: flex; align-items: center; gap: 8px; color: var(--red); font-family: var(--f-title); }
.donate p { margin: 8px 0 4px; color: var(--ink-2); }
.donate small { margin-top: 8px; text-align: center; }

.log { display: flex; gap: 12px; align-items: center; padding: 12px 14px; margin-bottom: 8px; }
.log-date { font: 700 1.3rem/1 var(--f-num); text-align: center; min-width: 40px; }
.log-date small { font: 600 .68rem/1 var(--f-num); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.log div { min-width: 0; }
.log strong { display: block; font-size: .92rem; }
.log .muted { font-size: .8rem; }
.empty { text-align: center; padding: 24px 16px; color: var(--muted); }
.empty .i { width: 34px; height: 34px; color: var(--line-2); margin-bottom: 6px; }

/* Ajustes */
.setting { padding: 6px 16px 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row small { color: var(--muted); font-size: .8rem; }
.set-row input[type=range] { width: 46%; accent-color: var(--green); }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: 11px; overflow: hidden; flex: none; }
.seg button { width: 40px; height: 38px; border: 0; background: transparent; font: 700 1.05rem/1 var(--f-num); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--green); color: var(--on-green); }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line-2); transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink-2); transition: .2s; }
.switch input:checked + span { background: var(--green); border-color: var(--green); }
.switch input:checked + span::after { transform: translateX(22px); background: var(--on-green); }
.switch input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }

/* Pantallas completas */
.screen { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; animation: slideIn .3s cubic-bezier(.2,.8,.2,1) both; }
.screen[hidden] { display: none; }
@keyframes slideIn { from { opacity: 0; transform: translateY(14px); } }
.screen-top {
  display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top) + 8px) 10px 8px;
  border-bottom: 1px solid var(--line);
}
.screen-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px 16px 24px; width: 100%; max-width: 540px; margin: 0 auto; }
.screen-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.screen-foot > .btn { max-width: 508px; margin: 0 auto; display: flex; }
.steps { flex: 1; display: flex; justify-content: center; gap: 6px; }
.step { font: 700 .8rem/1 var(--f-num); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-radius: 99px; }
.step.on { background: var(--green); color: var(--on-green); }
.step.done { color: var(--green); }
.wstep { display: none; }
.wstep.on { display: block; animation: fadeUp .3s ease both; }

/* Mapa del cuerpo */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 2px solid var(--line-2); background: var(--surface); }
.dot.st1 { background: var(--amber); border-color: var(--amber); }
.dot.st2 { background: var(--red); border-color: var(--red); }
.dot.st0 { background: var(--ok); border-color: var(--ok); }
.figures { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 4px 4px; text-align: center; box-shadow: var(--shadow); }
.figure svg { width: 100%; max-width: 170px; height: auto; display: block; margin: 0 auto; }
.figure-label { font: 700 .74rem/1 var(--f-num); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.fig-limb { stroke: var(--fig); stroke-linecap: round; fill: none; }
.fig-body { fill: var(--fig); }
.fig-mark { stroke: var(--fig-2); stroke-width: 1.5; fill: none; stroke-dasharray: 3 3; }
.hs { cursor: pointer; outline: none; }
.hs:focus-visible circle.ring { stroke: var(--green); stroke-width: 3.5; }
.hs circle.hit { fill: transparent; }
.hs circle.ring { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2; transition: fill .2s, stroke .2s; }
.hs.st1 circle.ring { fill: var(--amber); stroke: var(--amber); }
.hs.st2 circle.ring { fill: var(--red); stroke: var(--red); }
.hs.st1 circle.pulse, .hs.st2 circle.pulse { stroke-width: 2; fill: none; animation: pulse 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.hs.st1 circle.pulse { stroke: var(--amber); }
.hs.st2 circle.pulse { stroke: var(--red); }
.hs circle.pulse { stroke: none; fill: none; }
@keyframes pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(2.1); opacity: 0; } }

.zone-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.zbtn {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; text-align: left; cursor: pointer;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface);
}
.zbtn strong { display: block; font-size: .92rem; line-height: 1.15; }
.zbtn small { font-size: .76rem; color: var(--muted); }
.zbtn.st1 { background: var(--amber-bg); border-color: var(--amber); }
.zbtn.st1 small { color: var(--amber); font-weight: 600; }
.zbtn.st2 { background: var(--red-bg); border-color: var(--red); }
.zbtn.st2 small { color: var(--red); font-weight: 600; }

/* Misión */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface);
  font: 600 .95rem/1 var(--f-body); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.chip.on { background: var(--green); color: var(--on-green); border-color: var(--green); }
.chip.full { border-style: dashed; }
.chip.full.on { border-style: solid; }
.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt {
  text-align: left; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; position: relative; min-height: 64px;
}
.opt strong { display: block; font: 700 1.02rem/1.2 var(--f-title); }
.opt small { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.opt .pips { position: absolute; top: 12px; right: 12px; display: flex; gap: 3px; }
.opt .pips i { width: 6px; height: 14px; border-radius: 2px; background: var(--line); transform: skewX(-12deg); }
.opt .pips i.on { background: var(--leather); }
.opt.on { border-color: var(--green); box-shadow: 0 0 0 2px var(--green); background: color-mix(in srgb, var(--green) 8%, var(--surface)); }
.equip { display: grid; gap: 8px; }

/* Rutina */
.routine-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pill { font: 600 .82rem/1 var(--f-num); letter-spacing: .06em; text-transform: uppercase; padding: 7px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); display: inline-flex; gap: 5px; align-items: center; }
.pill .i { width: 14px; height: 14px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 12px; font-size: .9rem; }
.notice .i { margin-top: 1px; }
.notice.warn { background: var(--amber-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--amber) 50%, transparent); }
.notice.warn .i { color: var(--amber); }
.notice.bad { background: var(--red-bg); border: 1px solid color-mix(in srgb, var(--red) 45%, transparent); }
.notice.bad .i { color: var(--red); }
.warmup { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1.5px dashed var(--line-2); border-radius: var(--r-sm); margin-bottom: 12px; }
.warmup .i { color: var(--leather); width: 24px; height: 24px; }
.warmup small { color: var(--muted); font-size: .82rem; }
.routine { list-style: none; padding: 0; margin: 0; counter-reset: r; }
.ritem { display: flex; gap: 12px; align-items: center; padding: 12px; margin-bottom: 8px; }
.rnum { counter-increment: r; width: 34px; height: 38px; flex: none; display: grid; place-items: center; font: 700 1.15rem/1 var(--f-num); color: var(--on-green); background: var(--green); clip-path: polygon(0 0, 100% 0, 100% 72%, 50% 100%, 0 72%); }
.rinfo { flex: 1; min-width: 0; }
.rinfo strong { display: block; font-size: .98rem; line-height: 1.25; }
.rinfo .presc { font: 600 .92rem/1.2 var(--f-num); letter-spacing: .03em; color: var(--ink-2); margin-top: 3px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tag { font: 600 .72rem/1 var(--f-body); padding: 4px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.tag.care { background: var(--amber-bg); color: var(--amber); }
.swap-btn { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line-2); background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.swap-btn:active { transform: rotate(180deg); transition: transform .3s; }
.swap-btn[disabled] { opacity: .35; }

/* Entrenamiento */
.run-progress { flex: 1; min-width: 0; }
.run-count { font: 700 .8rem/1 var(--f-num); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.run-progress .bar { margin: 6px 0 0; height: 8px; }
.run-clock { font: 700 1.2rem/1 var(--f-num); min-width: 56px; text-align: right; padding-right: 6px; font-variant-numeric: tabular-nums; }
.run-body { display: flex; flex-direction: column; }
.run-card { flex: 1; display: flex; flex-direction: column; padding: 20px; margin: 0; }
.run-group { font: 700 .82rem/1 var(--f-num); letter-spacing: .16em; text-transform: uppercase; color: var(--leather); }
.run-name { font: 900 clamp(1.5rem, 7vw, 2rem)/1.15 var(--f-title); margin: 8px 0 10px; }
.run-tip { color: var(--ink-2); margin: 0 0 12px; }
.run-target { display: flex; align-items: baseline; justify-content: center; gap: 10px; margin: auto 0 4px; padding-top: 18px; }
.run-target b { font: 700 clamp(4.2rem, 22vw, 6rem)/.9 var(--f-num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.run-target span { font: 700 1.4rem/1 var(--f-num); color: var(--muted); text-transform: uppercase; }
.sets { display: flex; justify-content: center; gap: 8px; margin: 14px 0 18px; }
.sets i { width: 34px; height: 12px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line-2); transform: skewX(-14deg); }
.sets i.done { background: var(--green); border-color: var(--green); }
.sets i.cur { border-color: var(--green); border-width: 2px; }
.set-label { text-align: center; font: 700 1rem/1 var(--f-num); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.run-main { min-height: 76px; font-size: 1.3rem; width: 100%; margin-top: 4px; }
.run-main .i { width: 28px; height: 28px; }
.run-foot { display: flex; gap: 10px; justify-content: center; }
.run-foot .btn { flex: 1; max-width: 250px; }

.rest {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--green); color: var(--on-green); padding: 24px; padding-top: calc(env(safe-area-inset-top) + 24px);
  animation: fadeIn .25s ease both;
}
:root[data-theme="dark"] .rest { background: #1b2a20; color: var(--ink); }
.rest[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.rest-label { font: 700 1rem/1 var(--f-num); letter-spacing: .3em; text-transform: uppercase; opacity: .8; }
.rest-dial { position: relative; width: min(72vw, 320px); aspect-ratio: 1; display: grid; place-items: center; margin: 18px 0 6px; }
.rest-num { font: 700 clamp(6rem, 30vw, 9rem)/1 var(--f-num); font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.rest-num.low { color: #f3d27a; animation: beat 1s ease infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.06); } }
.rest-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); pointer-events: none; }
.rest-ring circle { fill: none; stroke-width: 3; stroke: rgba(245,238,220,.18); }
.rest-ring circle + circle { stroke: #f3d27a; stroke-linecap: round; stroke-dasharray: 339.3; transition: stroke-dashoffset .3s linear; }
.rest-next { text-align: center; opacity: .9; max-width: 340px; margin: 18px 0 22px; position: relative; z-index: 1; }
.rest-next small { font: 700 .8rem/1 var(--f-num); letter-spacing: .16em; text-transform: uppercase; opacity: .75; margin-bottom: 6px; }
.rest-next strong { font: 700 1.15rem/1.3 var(--f-title); }
.rest-btns { display: flex; gap: 12px; width: 100%; max-width: 400px; position: relative; z-index: 1; }
.rest-btns .btn { flex: 1; min-height: 60px; font-size: 1.1rem; }
.rest .btn-ghost { color: inherit; border-color: rgba(245,238,220,.4); }
.rest .btn-primary { background: #f5eedc; color: #1f2e24; box-shadow: none; }
.rest .btn-primary::before { border-color: rgba(31,46,36,.25); }

.sparks { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.spark { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #ffcf6b; box-shadow: 0 0 8px 2px #ff9b2f; animation: spark .7s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }

/* Resultado */
.res-body { display: flex; flex-direction: column; justify-content: center; padding-top: calc(env(safe-area-inset-top) + 24px); }
.res-shield { display: grid; place-items: center; margin: 10px 0 8px; }
.res-shield .shield-svg { width: 150px; height: auto; filter: drop-shadow(0 10px 18px rgba(40,25,10,.45)); animation: forge 1s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes forge { 0% { transform: scale(.3) rotate(-18deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
.res-shield.up .shield-svg { animation: forge 1s cubic-bezier(.2,1.4,.4,1) both, glow 2.4s ease-in-out 1s infinite; }
@keyframes glow { 50% { filter: drop-shadow(0 0 22px rgba(243,210,122,.85)); } }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 16px; }
.res-stats div { text-align: center; padding: 12px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); }
.res-stats b { display: block; font: 700 1.8rem/1 var(--f-num); }
.res-stats small { color: var(--muted); font-size: .76rem; margin-top: 4px; }
.res-new { display: flex; gap: 12px; align-items: center; padding: 12px; margin-bottom: 8px; border-color: var(--gold); animation: fadeUp .4s ease both; }
.res-donate { display: flex; align-items: center; justify-content: center; text-align: center; gap: 8px; margin: 18px auto 6px; color: var(--red); font-weight: 600; text-decoration: none; padding: 10px; }

/* Hoja modal y avisos */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(20, 14, 6, .5); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s ease both; }
.sheet-wrap[hidden] { display: none; }
.sheet {
  width: 100%; max-width: 540px; max-height: 88dvh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); animation: up .3s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { font: 900 1.3rem/1.2 var(--f-title); margin-bottom: 10px; }
.sheet p, .sheet li { color: var(--ink-2); }
.sheet ul { padding-left: 20px; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.toasts { position: fixed; left: 0; right: 0; top: calc(var(--top) + 8px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; max-width: 420px; width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  background: var(--ink); color: var(--bg); border-radius: 14px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: up .3s ease both;
}
.toast.out { opacity: 0; transform: translateY(-8px); transition: .25s; }
.toast strong { display: block; font-size: .92rem; }
.toast small { opacity: .8; font-size: .82rem; word-break: break-all; }
.toast .i { margin-top: 1px; }
.toast.success .i { color: #8fc79e; }
.toast.warn .i { color: #f3c262; }

/* Animaciones de ejercicios */
.anim { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.anim svg { display: block; width: 100%; height: auto; }
.an-n, .an-f { stroke: var(--ink); stroke-linecap: round; }
.an-f { opacity: .32; }
.an-cab { fill: var(--ink); }
.an-suelo { stroke: var(--line-2); stroke-width: 2; }
.an-eq { fill: var(--line); stroke: var(--line-2); stroke-width: 1.5; }
.an-eq-l { stroke: var(--line-2); stroke-linecap: round; }
.an-cable { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 3 2; }
.an-polea { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.an-manc rect { fill: var(--leather); }
.an-disco { fill: var(--leather); stroke: var(--surface-2); stroke-width: 2; }

.run-anim { width: min(62%, 230px); margin: -4px auto 10px; cursor: pointer; }
.run-name { margin-bottom: 4px; }
.aka { font-size: .84rem; color: var(--muted); font-style: italic; margin-bottom: 8px; }
small.aka { display: block; margin: 2px 0 0; font-size: .76rem; }
.pasos-box { margin: 4px 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.pasos-box summary { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; font-weight: 600; font-size: .92rem; list-style: none; }
.pasos-box summary::-webkit-details-marker { display: none; }
.pasos-box summary .i { width: 18px; height: 18px; color: var(--leather); }
.pasos-box[open] summary { border-bottom: 1px solid var(--line); }
.pasos-box .pasos, .pasos-box .clave { margin-left: 12px; margin-right: 12px; }
.pasos { counter-reset: p; list-style: none; padding: 0; margin: 12px 0 8px; }
.pasos li { counter-increment: p; position: relative; padding-left: 34px; margin-bottom: 10px; color: var(--ink-2); line-height: 1.4; }
.pasos li::before {
  content: counter(p); position: absolute; left: 0; top: -1px; width: 24px; height: 24px; display: grid; place-items: center;
  font: 700 .9rem/1 var(--f-num); color: var(--on-green); background: var(--green); border-radius: 7px;
}
.clave { font-size: .88rem; color: var(--ink-2); margin: 0 0 12px; }
.guia-anim { width: min(100%, 300px); margin: 0 auto 12px; }
.sheet .run-group { margin-bottom: 4px; }
.sheet .h3 { margin: 14px 0 8px; }
.tag.bad { background: var(--red-bg); color: var(--red); }
.rthumb { width: 64px; flex: none; padding: 0; border: 0; background: none; cursor: pointer; }
.rthumb .anim { border-radius: 9px; }
.rinfo[data-g] { cursor: pointer; }
.ritem { gap: 10px; }

/* Mis rutinas */
.mi-rutina { display: flex; align-items: center; gap: 6px; padding: 12px 12px 12px 16px; }
.mr-info { flex: 1; min-width: 0; }
.mr-info strong { display: block; font-family: var(--f-title); font-size: 1rem; line-height: 1.2; }
.mr-info small { color: var(--muted); font-size: .8rem; margin-top: 3px; }
.warn-txt { color: var(--red); font-weight: 600; }
.mr-go { min-height: 42px; padding: 0 14px; font-size: .92rem; }
.screen-title { flex: 1; text-align: center; font: 900 1.05rem/1 var(--f-title); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font: 700 .8rem/1 var(--f-num); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.field input, .search {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface);
  font: 500 1rem/1 var(--f-body); color: var(--ink);
}
.field input:focus, .search:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.search { margin-bottom: 10px; }
.chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 8px; padding: 0 16px 4px; scrollbar-width: none; }
.chips.scroll-x::-webkit-scrollbar { display: none; }
.chips.scroll-x .chip { flex: none; min-height: 38px; padding: 0 14px; font-size: .88rem; }
.eitem { padding: 10px; margin-bottom: 8px; display: block; }
.eitem.mal, .pitem.mal { border-color: color-mix(in srgb, var(--red) 55%, transparent); }
.eitem-top { display: flex; align-items: center; gap: 10px; }
.eitem-ord { display: flex; flex-direction: column; gap: 4px; }
.mini {
  width: 34px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; cursor: pointer;
  display: grid; place-items: center; font-size: .7rem; color: var(--ink-2); flex: none;
}
.mini[disabled] { opacity: .3; }
.mini.x { height: 64px; }
.mini .i { width: 16px; height: 16px; }
.eitem-ctl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.stp { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; text-align: center; background: var(--surface-2); border-radius: 10px; padding: 4px; }
.stp small { grid-column: 1 / -1; font: 700 .68rem/1 var(--f-num); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.stp b { font: 700 1.05rem/1 var(--f-num); }
.stp button { height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 1rem; }
.pitem { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 8px; }
.pitem.mal .rthumb, .pitem.mal .rinfo strong { opacity: .55; }
.add-btn {
  width: 46px; height: 46px; flex: none; border-radius: 12px; border: 1.5px solid var(--green); background: transparent; color: var(--green);
  display: grid; place-items: center; cursor: pointer;
}
.add-btn.on { background: var(--green); color: var(--on-green); }
.add-btn[disabled] { border-color: var(--line-2); color: var(--line-2); cursor: not-allowed; }

/* Registro de pesos */
.con-anot { padding: 14px 16px; }
.con-anot .run-anim { width: min(40%, 150px); margin-bottom: 4px; }
.con-anot .run-name { font-size: clamp(1.25rem, 5.6vw, 1.6rem); margin: 4px 0 2px; }
.con-anot .aka { margin-bottom: 4px; }
.con-anot .pasos-box { margin: 2px 0 4px; }
.con-anot .pasos-box summary { padding: 7px 12px; }
.con-anot .notice { padding: 8px 12px; margin-bottom: 6px; font-size: .84rem; }
.con-anot .run-target { padding-top: 4px; }
.con-anot .run-target b { font-size: clamp(2.8rem, 14vw, 3.6rem); }
.con-anot .sets { margin: 6px 0 6px; }
.con-anot .anotador { margin: 8px 0 10px; }
.con-anot .run-main { min-height: 62px; }
.anotador { margin: 12px 0 4px; }
.anot-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.stp.big { grid-template-columns: 40px 1fr 40px; padding: 6px; }
.stp.big button { height: 40px; font-size: 1.2rem; }
.stp.big b, .stp .num { font: 700 1.5rem/1 var(--f-num); }
.stp .num { border: 0 !important; background: transparent !important; text-decoration: underline dotted var(--line-2); text-underline-offset: 4px; }
.anot-ult, .anot-sug { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; color: var(--ink-2); margin-top: 8px; line-height: 1.35; }
.anot-ult .i, .anot-sug .i { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--leather); }
.anot-sug { background: var(--ok-bg); color: var(--ok); padding: 8px 10px; border-radius: 10px; font-weight: 600; }
.anot-sug .i { color: var(--ok); }
.anot-hoy { font: 600 .9rem/1.3 var(--f-num); letter-spacing: .03em; color: var(--green); margin-top: 6px; }
.guia-ult { margin: 12px 0 0; }
.prog { display: flex; width: 100%; align-items: center; gap: 12px; text-align: left; cursor: pointer; padding: 12px 14px; margin-bottom: 8px; }
.prog small { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.prog-kg { text-align: right; flex: none; }
.prog-kg b { font: 700 1.6rem/1 var(--f-num); }
.prog-kg small { display: inline; margin-left: 2px; }
.prog-kg span { display: block; font: 700 .82rem/1 var(--f-num); margin-top: 4px; }
.prog-kg .up { color: var(--ok); }
.prog-kg .down { color: var(--red); }
.prog-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px; }
.prog-stats div { text-align: center; padding: 10px 4px; background: var(--surface-2); border-radius: 10px; }
.prog-stats b { display: block; font: 700 1.5rem/1 var(--f-num); }
.prog-stats small { color: var(--muted); font-size: .74rem; margin-top: 3px; }
.graf { width: 100%; height: auto; display: block; }
.g-eje { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.g-lin { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.g-pt { fill: var(--surface); stroke: var(--green); stroke-width: 2; }
.g-txt { fill: var(--muted); font: 600 10px var(--f-body); }
.prog-hist { display: flex; flex-direction: column; gap: 6px; }
.ph-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; }
.ph-f { font: 700 .85rem/1 var(--f-num); min-width: 64px; color: var(--ink-2); }
.ph-s { flex: 1; font-size: .86rem; }
.ph-row .mini.x { height: 30px; width: 30px; }

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 360px) {
  .rank-card { grid-template-columns: 88px 1fr; }
  .rank-card .shield-svg { width: 88px; }
  .zone-list, .levels, .badges { grid-template-columns: 1fr; }
}
