:root {
  --bg: #0e1014;
  --bg-2: #151820;
  --card: #1a1e27;
  --card-2: #222733;
  --line: #2a303d;
  --text: #eef0f4;
  --muted: #9aa3b2;
  --faint: #6b7383;
  --accent: #ff7a45;

  --quality: #ff7a45;
  --easy: #2fd47c;
  --long: #4b8dff;
  --optional: #8e9bb0;
  --gym: #b07cff;
  --rest: #5f6878;
  --race: #ff4d6d;

  --ph1: #ff7a45;
  --ph2: #8e9bb0;
  --ph3: #2fd47c;
  --ph4: #f2b33d;
  --ph5: #7c83ff;

  --radius: 18px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 8px 24px rgba(0, 0, 0, .25);
  --tabs-h: 64px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f4f7;
    --bg-2: #e9ebf0;
    --card: #ffffff;
    --card-2: #f4f5f8;
    --line: #e2e5eb;
    --text: #151821;
    --muted: #5d6573;
    --faint: #8a92a0;
    --quality: #f0601f;
    --easy: #14a85c;
    --long: #2f6fe4;
    --optional: #74819a;
    --gym: #8b4fe6;
    --rest: #8a92a0;
    --race: #e2294b;
    --ph1: #f0601f;
    --ph2: #8a92a0;
    --ph3: #14a85c;
    --ph4: #d99512;
    --ph5: #5b62f0;
    --shadow: 0 1px 2px rgba(20, 24, 33, .06), 0 6px 18px rgba(20, 24, 33, .06);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }

svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

#view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px);
}

/* ------------------------------------------------------------ tabs */

.tabs {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line);
}

.tabs a {
  flex: 1;
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0 4px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: color .15s;
}

.tabs a svg { font-size: 23px; }
.tabs a.active { color: var(--accent); }
.tabs a.active svg { stroke-width: 2.4; }

/* ------------------------------------------------------------ header */

.hero { margin: 4px 2px 18px; }

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.hero h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.02em;
}

.hero h1 small { color: var(--faint); font-weight: 700; font-size: .62em; }

.hero .sub { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; color: var(--muted); font-size: 15px; }

.sec {
  margin: 26px 4px 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ------------------------------------------------------------ pills / chips */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, transparent);
  color: var(--c, var(--accent));
  white-space: nowrap;
}

.pill.ph1 { --c: var(--ph1); }
.pill.ph2 { --c: var(--ph2); }
.pill.ph3 { --c: var(--ph3); }
.pill.ph4 { --c: var(--ph4); }
.pill.ph5 { --c: var(--ph5); }
.pill.warn { --c: var(--ph4); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 14px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.chip svg { color: var(--k); font-size: 15px; }

/* ------------------------------------------------------------ cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card + .card { margin-top: 10px; }

.note {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--ph4) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--ph4) 30%, transparent);
  font-size: 14.5px;
}

.note svg { color: var(--ph4); font-size: 18px; margin-top: 1px; }

/* ------------------------------------------------------------ countdown */

.countdown { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.cd {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.cd::after {
  content: "";
  position: absolute;
  inset: auto -20px -40px auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--race) 30%, transparent), transparent 70%);
}

.cd .lbl { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cd .num { margin-top: 2px; font-size: 32px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cd .num small { font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.cd .when { font-size: 12.5px; color: var(--faint); }

/* ------------------------------------------------------------ day card */

.day {
  --k: var(--rest);
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: opacity .2s;
}

.day + .day { margin-top: 8px; }

.day::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--k);
}

.k-quality { --k: var(--quality); }
.k-easy { --k: var(--easy); }
.k-long { --k: var(--long); }
.k-optional { --k: var(--optional); }
.k-gym { --k: var(--gym); }
.k-rest { --k: var(--rest); }
.k-race { --k: var(--race); }

.day.k-optional::before { background: repeating-linear-gradient(to bottom, var(--k) 0 6px, transparent 6px 10px); }

.day.today { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }

.day-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 16px;
  text-align: left;
}

.day-head:not([data-act]) { cursor: default; }

.day-date {
  width: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
  color: var(--muted);
}

.day-date span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.day-date b { font-size: 21px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

.day-main { flex: 1; min-width: 0; }

.day-kind {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--k);
}

.day-kind svg { font-size: 14px; }

.tag {
  padding: 1px 7px;
  border-radius: 6px;
  font-style: normal;
  font-size: 10.5px;
  background: var(--accent);
  color: #fff;
  letter-spacing: .06em;
}

.day-title { margin-top: 1px; font-size: 16.5px; font-weight: 700; line-height: 1.25; }

.day-km { text-align: right; line-height: 1; font-variant-numeric: tabular-nums; }
.day-km b { display: block; font-size: 20px; font-weight: 800; }
.day-km span { font-size: 11.5px; color: var(--muted); font-weight: 600; }

.day-check {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--line);
  color: transparent;
  font-size: 15px;
}

.day.done .day-check { background: var(--easy); border-color: var(--easy); color: #fff; }
.day.done:not(.big) .day-title { color: var(--muted); }

.chev { color: var(--faint); font-size: 18px; transition: transform .2s; }
.day.open .chev { transform: rotate(180deg); }

.day-body { display: none; padding: 0 16px 16px 20px; }
.day.open .day-body { display: block; }

.blocks { display: grid; gap: 10px; }

.block {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card-2);
  font-size: 15.5px;
}

.block h4 {
  margin: 0 0 4px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}

.block.main { background: color-mix(in srgb, var(--k) 13%, var(--card-2)); }
.block.main h4 { color: var(--k); }

.block b.p { font-weight: 750; color: var(--text); white-space: nowrap; }

.mod { margin-bottom: 12px; }

.ex { list-style: none; margin: 0; padding: 0; }

.ex li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.ex li:last-child { border-bottom: 0; }
.ex li span:last-child { color: var(--muted); font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }

.ex-desc { margin: 0 0 4px; color: var(--muted); font-size: 14px; }

.btn-done {
  width: 100%;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  font-weight: 750;
  font-size: 16px;
  background: var(--k);
  color: #fff;
  transition: transform .1s, filter .15s;
}

.btn-done:active { transform: scale(.98); }
.day.done .btn-done { background: var(--card-2); color: var(--easy); border: 1px solid var(--line); }

/* big (Hoy) */

.day.big { border-radius: 22px; }
.day.big::before { width: 100%; height: 5px; inset: 0 0 auto 0; }
.day.big.k-optional::before { background: repeating-linear-gradient(to right, var(--k) 0 10px, transparent 10px 16px); }
.day.big .day-head { padding: 22px 18px 14px; align-items: flex-start; cursor: default; }
.day.big .day-date { display: none; }
.day.big .day-title { font-size: 25px; font-weight: 800; letter-spacing: -.015em; margin-top: 4px; }
.day.big .day-km b { font-size: 36px; letter-spacing: -.02em; }
.day.big .day-body { display: block; padding: 0 18px 18px; }
.day.big .chev { display: none; }

/* ------------------------------------------------------------ week progress */

.wk { padding: 16px; }

.wk-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.wk-top b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.wk-top span { color: var(--muted); font-size: 14px; }

.bar { height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--easy), var(--long)); width: 0; transition: width .4s; }

.dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 14px; }

.dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--faint);
}

.dot i {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--k);
  color: var(--k);
  font-size: 14px;
  font-style: normal;
}

.dot.done i { background: var(--k); color: #fff; }
.dot.today { color: var(--accent); }
.dot.today i { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.dot.k-optional i { border-style: dashed; }

/* ------------------------------------------------------------ plan */

.chart-wrap { padding: 14px 12px 10px; }

.chart {
  height: 96px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}

.chart .b {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  border-radius: 4px;
  position: relative;
}

.chart .b span {
  width: 100%;
  height: calc(var(--h) * 100%);
  min-height: 6px;
  border-radius: 4px 4px 2px 2px;
  background: var(--c);
  opacity: .45;
  transition: opacity .15s, transform .15s;
}

.chart .b.desc span { opacity: .25; }
.chart .b.sel span { opacity: 1; }
.chart .b.cur::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--accent);
}

.chart .b.ph1 { --c: var(--ph1); }
.chart .b.ph2 { --c: var(--ph2); }
.chart .b.ph3 { --c: var(--ph3); }
.chart .b.ph4 { --c: var(--ph4); }
.chart .b.ph5 { --c: var(--ph5); }

.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 16px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }

.weeknav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 10px;
}

.weeknav .mid { text-align: center; }
.weeknav .mid b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.weeknav .mid span { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

.navbtn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 20px;
}

.navbtn:disabled { opacity: .3; }

.wsum h3 { margin: 8px 0 4px; font-size: 19px; line-height: 1.25; }
.wsum .pills { display: flex; flex-wrap: wrap; gap: 6px; }
.wsum .kms { display: flex; gap: 18px; margin: 12px 0 10px; }
.wsum .kms div { font-size: 13px; color: var(--muted); }
.wsum .kms b { display: block; font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }

.days { margin-top: 12px; touch-action: pan-y; }

.fab {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px);
  transform: translateX(-50%);
  z-index: 9;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  font-size: 14.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}

/* ------------------------------------------------------------ ritmos */

.zone { display: flex; gap: 14px; align-items: center; }
.zone + .zone { margin-top: 10px; }
.zone .sw { width: 6px; align-self: stretch; border-radius: 4px; background: var(--c); }
.zone .zi { flex: 1; min-width: 0; }
.zone h3 { margin: 0; font-size: 15px; font-weight: 700; }
.zone p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.zone .zp { text-align: right; }
.zone .zp b { display: block; font-size: 19px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.zone .zp span { font-size: 12.5px; color: var(--muted); font-weight: 650; white-space: nowrap; }

.list { list-style: none; margin: 0; padding: 0; }

.list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.list li:first-child { padding-top: 2px; }
.list li:last-child { border-bottom: 0; padding-bottom: 2px; }
.list .ic {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--k) 16%, transparent);
  color: var(--k);
  font-size: 16px;
  flex: none;
}
.list b { display: block; font-size: 14px; }
.list small { color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------ acordeones */

details.acc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

details.acc + details.acc { margin-top: 10px; }

details.acc summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  list-style: none;
  cursor: pointer;
}

details.acc summary::-webkit-details-marker { display: none; }
details.acc summary .t { flex: 1; min-width: 0; }
details.acc summary b { display: block; font-size: 16px; }
details.acc summary small { color: var(--muted); font-size: 13.5px; }
details.acc[open] summary .chev { transform: rotate(180deg); }
details.acc .in { padding: 0 16px 14px; }

/* ------------------------------------------------------------ info */

.kv { display: grid; gap: 12px; }
.kv div h4 { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--k, var(--accent)); }
.kv div p { margin: 2px 0 0; font-size: 15px; }

.phase-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.phase-row:last-child { border-bottom: 0; padding-bottom: 0; }
.phase-row:first-child { padding-top: 0; }
.phase-row .sw { width: 6px; border-radius: 4px; background: var(--c); }
.phase-row .pi { flex: 1; }
.phase-row b { font-size: 15px; }
.phase-row p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.phase-row .meta { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.phase-row.cur b::after { content: "Ahora"; margin-left: 8px; padding: 1px 7px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; vertical-align: 2px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px; }
.stat b { display: block; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--muted); }

.foot { margin: 24px 6px 0; font-size: 12.5px; color: var(--faint); text-align: center; }

@media (min-width: 600px) {
  #view { padding-top: 32px; }
}
