/* Vibe Training — base tranquila, momentos épicos solo cuando te los ganas. */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(/fonts/archivo-latin.woff2) format('woff2-variations'), url(/fonts/archivo-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(/fonts/archivo-latin-ext.woff2) format('woff2-variations'), url(/fonts/archivo-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  /* tiza y acero: pared de gym, no papel crema */
  --bg: #eef1f3;
  --bg-2: #e2e7eb;
  --surface: #ffffff;
  --ink: #15191d;
  --ink-2: #4a535c;
  --ink-3: #5f6973;
  --line: #d5dbe0;
  --line-2: #bfc7ce;
  --iron: #26323d;          /* acero de barra: acción neutra */
  --on-iron: #ffffff;
  --risk: #c2560f;          /* racha en juego (marcador) */
  --danger-text: #a8460a;   /* texto de error: 5,2:1 sobre la tiza */
  /* discos olímpicos: 25 rojo, 20 azul, 15 amarillo, 10 verde */
  --push: #b8261f; --on-push: #ffffff;
  --pull: #2461c4; --on-pull: #ffffff;
  --legs: #b58600; --on-legs: #15191d;
  --extra: #46b577; --on-extra: #15191d;
  --hub: #c9d0d6;
  --shadow: 0 -12px 40px rgb(21 25 29 / 0.16);
  --backdrop: rgb(21 25 29 / 0.42);

  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --gutter: 16px;
  --tabbar-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out-back: cubic-bezier(.34, 1.56, .64, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    /* goma de suelo de gym */
    --bg: #1e2227;
    --bg-2: #272c32;
    --surface: #2a3037;
    --ink: #eef1f3;
    --ink-2: #b4bcc4;
    --ink-3: #8f99a3;
    --line: #353c44;
    --line-2: #48515b;
    --iron: #c9d3dc;
    --on-iron: #15191d;
    --risk: #f0913f;
    --danger-text: #f0a060;
    --push: #c03830; --on-push: #ffffff;
    --pull: #5a8def; --on-pull: #15191d;
    --legs: #b48e10; --on-legs: #15191d;
    --extra: #35a577; --on-extra: #15191d;
    --hub: #59626c;
    --shadow: 0 -12px 40px rgb(0 0 0 / 0.5);
    --backdrop: rgb(8 10 12 / 0.62);
  }
}

/* color de categoría activo: lo pone el contenedor con data-day */
[data-day='push'] { --c: var(--push); --on-c: var(--on-push); }
[data-day='pull'] { --c: var(--pull); --on-c: var(--on-pull); }
[data-day='legs'] { --c: var(--legs); --on-c: var(--on-legs); }
[data-day='extra'] { --c: var(--extra); --on-c: var(--on-extra); }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
img, svg { display: block; }
h1, h2, h3, p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  max-width: 560px;
  margin: 0 auto;
}
.view { min-height: 0; min-width: 0; display: flex; flex-direction: column; position: relative; }
.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(var(--safe-top) + 14px) var(--gutter) 24px;
  scrollbar-width: none;
}
.scroll::-webkit-scrollbar { display: none; }
.actionbar {
  padding: 10px var(--gutter) 12px;
  display: flex;
  gap: 10px;
  background: linear-gradient(to bottom, transparent, var(--bg) 18px);
  margin-top: -18px;
  position: relative;
  z-index: 2;
}
.actionbar > * { flex: 1; }
.actionbar > .btn-secondary { flex: 0 0 auto; }

.tabbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0 8px var(--safe-bottom);
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.tab {
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 560;
  position: relative;
  text-decoration: none;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current='page'] { color: var(--ink); }
.tab[aria-current='page']::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 30%;
  right: 30%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--ink);
}

/* ---------- tipografía de métricas ---------- */
.metric {
  font-stretch: 68%;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 0.86;
}
.metric-xl { font-size: clamp(76px, 27vw, 132px); }
.metric-l { font-size: clamp(56px, 18vw, 84px); }
.metric-m { font-size: 40px; }
.metric-s { font-size: 28px; }
.metric-unit { font-stretch: 85%; font-weight: 650; font-size: 0.34em; letter-spacing: 0; margin-left: 0.12em; color: var(--ink-2); }

.title { font-size: 26px; font-weight: 760; font-stretch: 82%; line-height: 1.05; letter-spacing: -0.005em; }
.section-title { font-size: 20px; font-weight: 740; font-stretch: 85%; line-height: 1.1; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }

/* ---------- botones ---------- */
.btn-primary, .btn-secondary, .btn-ghost {
  min-height: 54px;
  border-radius: var(--r-m);
  padding: 0 20px;
  font-size: 17px;
  font-weight: 700;
  font-stretch: 90%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 120ms var(--ease), background-color 160ms;
  user-select: none;
  -webkit-user-select: none;
}
.btn-primary { background: var(--iron); color: var(--on-iron); }
.btn-primary.day, [data-day] .btn-primary.day { background: var(--c); color: var(--on-c); }
.btn-secondary { background: var(--bg-2); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); min-height: 44px; font-weight: 620; padding: 0 12px; }
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.5; cursor: default; }
.btn-primary svg, .btn-secondary svg { width: 22px; height: 22px; flex: none; }
.btn-ghost svg { width: 20px; height: 20px; flex: none; }
.btn-primary .label-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--ink-2);
  flex: none;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:active, .btn-secondary:active, .btn-ghost:active { background: var(--bg-2); }
.link-btn { color: var(--ink-2); font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); min-height: 44px; }
@media (prefers-reduced-motion: no-preference) {
  .btn-primary:active, .btn-secondary:active { transform: scale(0.97); }
}

/* ---------- inputs ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border-radius: var(--r-s);
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  font-size: 17px;
}
.input:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.row-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--bg-2);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  min-height: 40px;
  border-radius: 9px;
  font-weight: 650;
  font-size: 15px;
  color: var(--ink-2);
}
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }

/* ---------- hoy ---------- */
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px -6px 6px 0; }
.topline .date { font-size: 15px; font-weight: 620; color: var(--ink-2); }
.seg-dates { flex: 0 1 260px; padding: 3px; }
.seg-dates button { min-height: 36px; font-size: 14px; }
.list-foot { padding-top: 8px; }
.wordmark { font-weight: 800; font-stretch: 75%; font-size: 17px; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 7px; }
.wordmark .plate-mini { width: 16px; height: 16px; }

.day-hero { display: flex; align-items: center; gap: 16px; margin: 6px 0 14px; }
.day-hero .plate { width: 76px; height: 76px; flex: none; }
.day-hero h1 { font-size: clamp(64px, 21vw, 96px); font-weight: 820; font-stretch: 66%; line-height: 0.84; letter-spacing: -0.015em; }
.day-hero .why { margin-top: 8px; font-size: 15px; color: var(--ink-2); }

.week-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; }
.week-bar .week-plates { flex: none; height: 40px; width: auto; max-width: 70%; overflow: visible; }
.week-bar .txt { font-size: 14px; color: var(--ink-2); text-align: right; line-height: 1.2; }
.week-bar .txt b { color: var(--ink); font-weight: 800; font-size: 26px; font-stretch: 68%; display: block; }

.day-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 14px; }
.day-picker .day-pill { justify-content: center; padding: 0 6px; gap: 6px; font-size: 15px; min-width: 0; }
.day-pill {
  flex: none;
  min-height: 44px;
  padding: 0 16px 0 10px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 680;
  font-size: 16px;
}
.day-pill .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 5px var(--c), inset 0 0 0 9px var(--hub); }
.day-pill[aria-pressed='true'] { background: var(--c); color: var(--on-c); border-color: var(--c); }
.day-pill[aria-pressed='true'] .dot { box-shadow: inset 0 0 0 5px var(--on-c), inset 0 0 0 9px var(--c); background: var(--on-c); }
.day-pill .done { width: 18px; height: 18px; }

.gym-line {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-align: left;
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.gym-line .state-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }
.gym-line[data-open='true'] .state-dot { background: var(--ink); }
.gym-line[data-open='unknown'] .state-dot { border-style: dashed; border-color: var(--ink-3); }
.gym-line b { color: var(--ink); font-weight: 680; }
.gym-line svg { width: 18px; height: 18px; margin-left: auto; color: var(--ink-3); }

.note-line { font-size: 14px; color: var(--ink-2); padding: 10px 0; border-top: 1px solid var(--line); }

.ex-list { border-top: 1px solid var(--line); }
.ex-row {
  width: 100%;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  min-height: 72px;
}
.ex-idx { font-weight: 760; font-stretch: 70%; font-size: 20px; color: var(--ink-3); text-align: center; }
.ex-row[data-state='done'] .ex-idx { color: var(--ink); }
.ex-row[data-state='done'] .ex-idx svg { width: 22px; height: 22px; margin: 0 auto; }
.ex-name { display: block; font-size: 17px; font-weight: 650; line-height: 1.2; }
.ex-target { display: block; margin-top: 3px; font-size: 14px; color: var(--ink-2); }
.ex-metric { text-align: right; display: grid; justify-items: end; }
.ex-weight { font-size: 34px; }
.ex-row[data-state='pending'] .ex-weight { color: var(--ink-3); }
.ex-row[data-state='skipped'] .ex-weight { color: var(--ink-3); font-size: 18px; font-stretch: 85%; font-weight: 700; }
.ex-sub { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-top: 3px; }
.ex-sub.pr { color: var(--ink); }
.ex-sub.pr::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 5px; vertical-align: 1px; }

.empty { padding: 28px 0; color: var(--ink-2); text-align: center; }

/* ---------- sheet (dialog) ---------- */
dialog.sheet {
  margin: auto auto 0;
  padding: 0;
  border: 0;
  width: 100%;
  max-width: 560px;
  max-height: min(92dvh, 900px);
  border-radius: var(--r-l) var(--r-l) 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
dialog.sheet::backdrop { background: var(--backdrop); }
.sheet-inner { display: flex; flex-direction: column; max-height: inherit; }
.sheet-drag { flex: none; touch-action: none; }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px 4px var(--gutter); flex: none; touch-action: none; }
.sheet-head h2 { flex: 1; font-size: 22px; font-weight: 760; font-stretch: 82%; line-height: 1.12; padding-top: 9px; }
.sheet-body { padding: 8px var(--gutter) 16px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.sheet-actions { padding: 10px var(--gutter) calc(12px + var(--safe-bottom)); display: flex; gap: 10px; border-top: 1px solid var(--line); flex: none; }
.sheet-actions > * { flex: 1; }
.sheet-actions > .btn-secondary { flex: 0 1 auto; }
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: sheet-in 260ms var(--ease); }
  dialog.sheet[open]::backdrop { animation: fade-in 260ms var(--ease); }
  dialog.sheet.closing { animation: sheet-out 200ms var(--ease) forwards; }
  dialog.sheet.closing::backdrop { animation: fade-out 200ms var(--ease) forwards; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* ---------- registro de peso ---------- */
.log-status { font-size: 15px; color: var(--ink-2); display: flex; gap: 8px; align-items: baseline; }
.log-status::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); transform: translateY(-1px); }
.log-status.warn::before { background: var(--risk); }
.stepper { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; gap: 8px; }
.stepper button { width: 64px; height: 64px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; }
.stepper button svg { width: 28px; height: 28px; }
.stepper button:active { background: var(--line); }
.weight-input-wrap { display: flex; align-items: baseline; justify-content: center; gap: 4px; min-width: 0; }
.weight-input-wrap .weight-input { flex: none; max-width: 100%; }
.weight-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: clamp(64px, 22vw, 96px);
  font-weight: 820;
  font-stretch: 64%;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  padding: 0;
  border-bottom: 3px solid transparent;
}
.weight-input:focus-visible { outline: none; border-bottom-color: var(--c, var(--ink)); }
.weight-input::placeholder { color: var(--line-2); }
.weight-unit { font-size: 22px; font-weight: 700; font-stretch: 85%; color: var(--ink-2); }
.reps-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.reps-row::-webkit-scrollbar { display: none; }
.reps-row button { flex: none; min-width: 44px; height: 44px; border-radius: 12px; background: var(--bg-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.reps-row button[aria-pressed='true'] { background: var(--c); color: var(--on-c); }
.history { display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.history li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 5px 0; }
.history b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sub-label { font-size: 14px; font-weight: 650; color: var(--ink-2); margin-bottom: 8px; }

/* ---------- comida ---------- */
.kcal-hero { margin: 8px 0 6px; }
.kcal-hero .of { font-size: 17px; color: var(--ink-2); margin-top: 8px; }
.meter { position: relative; height: 10px; border-radius: 5px; background: var(--bg-2); overflow: visible; margin: 14px 0 4px; }
.meter > i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--iron); max-width: 100%; }
.meter.over > i { background: var(--risk); }
.meter .tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.macros { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 14px; margin: 18px 0 8px; }
.macro .label { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.macro .v { margin-top: 4px; }
.macro .t { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.macro .meter { height: 6px; margin: 8px 0 0; }
.coach-line { font-size: 16px; line-height: 1.4; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 10px 0 6px; display: flex; gap: 10px; }
.coach-line::before { content: ''; flex: none; width: 4px; border-radius: 2px; background: var(--ink-3); }
.coach-line[data-tone='warn']::before { background: var(--risk); }
.coach-line[data-tone='ok']::before { background: var(--ink); }
.food-list li { border-bottom: 1px solid var(--line); }
.food-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 0; text-align: left; min-height: 56px; }
.food-row .n { font-weight: 620; line-height: 1.25; }
.food-row .m { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.food-row .k { font-weight: 780; font-stretch: 72%; font-size: 22px; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--bg-2); font-size: 14px; font-weight: 620; white-space: nowrap; display: inline-flex; align-items: center; max-width: 240px; }
.chip-t { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chip small { color: var(--ink-2); font-weight: 600; margin-left: 6px; }
.photo-preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--r-m); background: var(--bg-2); }
.est-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.est-list .n { font-weight: 620; }
.est-list .p { font-size: 13px; color: var(--ink-3); }
.est-list .k { font-weight: 760; font-stretch: 72%; font-size: 20px; font-variant-numeric: tabular-nums; text-align: right; }
.est-total { display: flex; justify-content: space-between; align-items: baseline; }
.skeleton { height: 16px; border-radius: 6px; background: var(--bg-2); }


/* ---------- progreso ---------- */
.streak-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: 14px; margin: 4px 0 6px; }
.streak-hero .label { font-size: 17px; font-weight: 650; line-height: 1.2; padding-bottom: 10px; }
.streak-hero .label small { display: block; font-size: 14px; font-weight: 500; color: var(--ink-2); margin-top: 4px; }
.streak-state { display: flex; gap: 8px; align-items: baseline; font-size: 15px; color: var(--ink-2); margin-bottom: 18px; }
.streak-state::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); flex: none; transform: translateY(1px); }
.streak-state[data-state='en-juego']::before { background: var(--risk); }
.streak-state[data-state='rota']::before, .streak-state[data-state='perdida']::before { background: transparent; border: 2px solid var(--ink-3); }
.streak-state[data-state='en-juego'] b { color: var(--ink); }

.wall { margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
.wall svg { width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.wall .cell-empty { fill: var(--line-2); }
.wall .cell-future { fill: var(--line); }
.wall .hub { fill: var(--bg); }
.wall .today-ring { fill: none; stroke: var(--ink); stroke-width: 2; }
.wall text { fill: var(--ink-3); font-size: 11px; font-weight: 600; font-family: var(--font); }
.wall .sel-ring { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.wall-tip { min-height: 22px; font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 4px; font-size: 14px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 4px var(--c), inset 0 0 0 7px var(--bg); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px 0 6px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats .v { font-size: 34px; }
.stats .l { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

.level { margin: 22px 0 8px; }
.level-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.level-name { font-size: 30px; font-weight: 800; font-stretch: 70%; }
.level .meter > i { background: var(--ink); }

.block { margin-top: 30px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.block-head .btn-ghost { margin-right: -12px; }
.spark { width: 100%; height: 56px; margin-top: 10px; }
.spark path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--ink); }
.suggest { margin-top: 12px; padding: 14px; border-radius: var(--r-m); background: var(--bg-2); display: grid; gap: 12px; }
.rec-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.rec-list .sw { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.rec-list .n { font-weight: 620; line-height: 1.2; }
.rec-list .d { font-size: 13px; color: var(--ink-3); }
.rec-list .w { font-size: 24px; }
.table-view { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.table-view th, .table-view td { text-align: left; padding: 7px 0; border-bottom: 1px solid var(--line); }
.table-view th { color: var(--ink-2); font-weight: 650; }

/* ---------- coach ---------- */
.chat { display: flex; flex-direction: column; gap: 14px; padding-bottom: 6px; }
.msg { max-width: 88%; line-height: 1.45; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--bg-2); padding: 10px 14px; border-radius: 18px 18px 6px 18px; }
.msg.coach { align-self: flex-start; }
.msg.coach.err { color: var(--ink-2); }
.msg.coach .caret { display: inline-block; width: 8px; height: 1.05em; background: var(--ink); vertical-align: -2px; margin-left: 2px; }

.chat-intro { color: var(--ink-2); padding: 12px 0 4px; }
.chat-intro .title { color: var(--ink); margin-bottom: 8px; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 8px var(--gutter) 10px; }
.composer textarea { flex: 1; min-height: 50px; max-height: 140px; resize: none; padding: 13px 14px; border-radius: 25px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: 16px; line-height: 1.35; }
.composer .send { width: 50px; height: 50px; border-radius: 50%; background: var(--iron); color: var(--on-iron); display: grid; place-items: center; flex: none; }
.composer .send:disabled { opacity: 0.4; }
.composer .send svg { width: 22px; height: 22px; }
.quick { padding: 0 var(--gutter); margin: 0; }

/* ---------- ajustes / rutina ---------- */
.page-head { display: flex; align-items: center; gap: 4px; margin: -6px 0 12px -10px; }
.page-head h1 { font-size: 28px; font-weight: 780; font-stretch: 80%; }
.set-group { margin-top: 22px; }
.set-group > h2 { font-size: 15px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.set-row .l { font-weight: 600; }
.set-row .d { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.set-row .v { color: var(--ink-2); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.set-row svg { width: 18px; height: 18px; color: var(--ink-3); }
.set-row .input { width: 110px; min-height: 44px; text-align: right; }
.model-list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; }
.model-list .i { font-weight: 760; font-stretch: 70%; color: var(--ink-3); }
.model-list .n { font-weight: 620; overflow-wrap: anywhere; }
.model-list .d { font-size: 13px; color: var(--ink-3); }
.model-list .c { font-size: 13px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }

.rt-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 14px; }
.rt-tabs .day-pill { justify-content: center; padding: 0 6px; gap: 6px; font-size: 15px; min-width: 0; }
.rt-day-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.rt-list li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); min-height: 64px; background: var(--bg); }
.rt-list li.dragging { position: relative; z-index: 3; box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); border-radius: 10px; }
.rt-grip { width: 36px; height: 48px; display: grid; place-items: center; color: var(--ink-3); touch-action: none; cursor: grab; }
.rt-grip svg { width: 20px; height: 20px; }
.rt-main { text-align: left; padding: 10px 0; min-width: 0; }
.rt-main .n { font-weight: 640; display: block; }
.rt-main .s { font-size: 14px; color: var(--ink-2); }
.rt-actions { display: flex; }
.rt-actions .icon-btn { width: 40px; height: 40px; }
.rt-actions svg { width: 20px; height: 20px; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--safe-top) + 24px) var(--gutter) calc(var(--safe-bottom) + 24px); max-width: 460px; margin: 0 auto; gap: 18px; overflow-y: auto; height: 100dvh; }
.auth .brand { display: flex; align-items: center; gap: 12px; }
.auth .brand svg { width: 52px; height: 52px; }
.auth .brand b { font-size: 38px; font-weight: 820; font-stretch: 66%; line-height: 0.9; letter-spacing: -0.01em; }
.auth p { color: var(--ink-2); }
.qr { background: #fff; padding: 14px; border-radius: var(--r-m); width: min(260px, 70vw); aspect-ratio: 1; margin: 0 auto; }
.qr svg { width: 100%; height: 100%; }
.secret { font-size: 15px; font-weight: 650; letter-spacing: 0.04em; text-align: center; overflow-wrap: anywhere; color: var(--ink); background: var(--bg-2); padding: 10px; border-radius: var(--r-s); user-select: all; -webkit-user-select: all; }
.code-input { font-size: 34px; font-weight: 780; font-stretch: 72%; text-align: center; letter-spacing: 0.3em; min-height: 64px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes li { background: var(--bg-2); border-radius: var(--r-s); padding: 10px; text-align: center; font-weight: 650; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all; }
.error { color: var(--danger-text); font-weight: 600; font-size: 15px; min-height: 1.2em; }

/* ---------- toast ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 84px); display: grid; justify-items: center; gap: 8px; pointer-events: none; z-index: 50; padding: 0 var(--gutter); }
.toast { max-width: 520px; background: var(--iron); color: var(--on-iron); padding: 12px 16px; border-radius: 14px; font-size: 15px; font-weight: 600; box-shadow: 0 6px 20px rgb(0 0 0 / 0.2); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: toast-in 240ms var(--ease-out-back); } @keyframes toast-in { from { transform: translateY(12px) scale(0.96); opacity: 0; } } }

/* ---------- momentos: solo tras una acción del usuario ---------- */
.moment {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--c, var(--iron));
  color: var(--on-c, var(--on-iron));
  padding: calc(var(--safe-top) + 24px) 24px calc(var(--safe-bottom) + 24px);
  text-align: center;
  overflow: hidden;
  border: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
}
.moment::backdrop { background: transparent; }
.moment-inner { display: grid; gap: 14px; justify-items: center; max-width: 440px; width: 100%; }
.moment .kicker { font-size: 18px; font-weight: 700; font-stretch: 85%; opacity: 0.9; }
.moment .big { font-size: clamp(110px, 38vw, 200px); font-weight: 860; font-stretch: 62%; line-height: 0.82; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.moment .big small { font-size: 0.28em; font-weight: 700; font-stretch: 80%; margin-left: 0.08em; }
.moment .what { font-size: 22px; font-weight: 740; font-stretch: 82%; line-height: 1.15; }
.moment .sub { font-size: 16px; opacity: 0.88; max-width: 34ch; }
.moment .bar-stage { width: 100%; height: 120px; }
.moment .tap { margin-top: 18px; font-size: 16px; font-weight: 700; min-height: 48px; padding: 0 28px; border-radius: 999px; background: color-mix(in srgb, currentColor 16%, transparent); color: inherit; }
.moment .tap:focus-visible { outline-color: currentColor; }
.moment:not([open]) { display: none; }
.moment .commit-hash { font-weight: 700; letter-spacing: 0.06em; opacity: 0.85; }
@media (prefers-reduced-motion: no-preference) {
  .moment[open] { animation: moment-in 380ms var(--ease); }
  .moment .big { animation: slam 620ms 240ms var(--ease-out-back) both; }
  .moment .what, .moment .sub, .moment .kicker { animation: rise 420ms 520ms var(--ease) both; }
  .moment .tap { animation: rise 420ms 1100ms var(--ease) both; }
  .moment .plate-l { animation: load-l 520ms var(--ease-out-back) both; }
  .moment .plate-r { animation: load-r 520ms var(--ease-out-back) both; }
  .moment.closing { animation: moment-out 220ms var(--ease) forwards; }
}
@keyframes moment-in { from { clip-path: circle(0% at 50% 100%); } to { clip-path: circle(150% at 50% 100%); } }
@keyframes moment-out { to { opacity: 0; transform: scale(1.03); } }
@keyframes slam { from { transform: scale(1.9); opacity: 0; filter: blur(6px); } to { transform: none; opacity: 1; filter: none; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
@keyframes load-l { from { transform: translateX(-160px); opacity: 0; } }
@keyframes load-r { from { transform: translateX(160px); opacity: 0; } }

/* banner de commit (primer registro del día) */
.commit-banner {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 84px);
  z-index: 60;
  max-width: 528px;
  margin: 0 auto;
  background: var(--c);
  color: var(--on-c);
  border-radius: var(--r-m);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.22);
  pointer-events: none;
}
.commit-banner .n { font-size: 44px; font-weight: 860; font-stretch: 62%; line-height: 0.85; font-variant-numeric: tabular-nums; }
.commit-banner .t { font-weight: 720; font-size: 16px; line-height: 1.2; }
.commit-banner .s { font-size: 14px; opacity: 0.9; display: block; }
@media (prefers-reduced-motion: no-preference) {
  .commit-banner { animation: banner-in 480ms var(--ease-out-back); }
  .commit-banner.out { animation: banner-out 260ms var(--ease) forwards; }
  @keyframes banner-in { from { transform: translateY(40px) scale(0.9); opacity: 0; } }
  @keyframes banner-out { to { transform: translateY(20px); opacity: 0; } }
  .week-bar .new-plate { animation: plate-roll 700ms var(--ease-out-back) both; transform-box: fill-box; transform-origin: center; }
  @keyframes plate-roll { from { transform: translateX(60px) rotate(200deg) scale(0.5); opacity: 0; } }
}

.haptic-ios { position: fixed; left: -100px; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- escritorio ---------- */
@media (min-width: 700px) {
  body { background: var(--bg-2); }
  .app { background: var(--bg); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .actionbar { background: linear-gradient(to bottom, transparent, var(--bg) 18px); }
}
@media (hover: hover) {
  .ex-row:hover, .food-row:hover, .set-row:hover { background: color-mix(in srgb, var(--bg-2) 55%, transparent); }
}
@media (forced-colors: active) {
  .day-pill .dot, .legend i, .rec-list .sw { forced-color-adjust: none; }
}
