*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--c-bg); color: var(--c-ink);
  font-family: var(--font); font-size: var(--fs-md); line-height: var(--lh-md);
  font-feature-settings: 'cv11', 'ss01'; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout general */
.page { max-width: var(--w-page); margin: 0 auto; padding: 0 var(--gutter) calc(var(--bar-h, 0px) + var(--s-6)); }
.top { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 700; letter-spacing: -0.02em; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: var(--s-2); }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-accent); }
.top-meta { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-ink-3); font-variant-numeric: tabular-nums; }

h1, h2, h3, p { margin: 0; }
.display { font-size: var(--fs-2xl); line-height: var(--lh-2xl); font-weight: 650; letter-spacing: -0.03em; }
.h2 { font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 650; letter-spacing: -0.02em; }
.h3 { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; }
.lead { font-size: var(--fs-md); line-height: var(--lh-md); color: var(--c-ink-2); }
.small { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-ink-3); }
.num { font-variant-numeric: tabular-nums; }

/* Botones de la app */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-5); border-radius: var(--r-md);
  font-size: var(--fs-md); font-weight: 600; border: 1px solid transparent; cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn-pri { background: var(--c-ink); color: #fff; }
.btn-pri:hover { background: #2B2B2B; }
.btn-sec { background: var(--c-surface); border-color: var(--c-line-strong); }
.btn-sec:hover { border-color: var(--c-ink); }
.btn-ghost { background: none; padding: 0 var(--s-2); color: var(--c-ink-2); font-weight: 500; }
.btn-ghost:hover { color: var(--c-ink); }
.btn-block { width: 100%; }
.stack-btns { display: flex; flex-direction: column; gap: var(--s-3); }
@media (min-width: 720px) { .stack-btns { flex-direction: row; } .stack-btns .btn-block { width: auto; } }

/* Inicio */
.home { padding-top: var(--s-6); display: flex; flex-direction: column; }
.home .display { max-width: 12ch; }
@media (min-width: 720px) { .home .display { max-width: 18ch; font-size: 48px; line-height: 52px; } }
.home .lead { margin-top: var(--s-4); max-width: 44ch; }
.today { margin-top: var(--s-6); padding: var(--s-5); background: var(--c-surface); border: var(--border); border-radius: var(--r-lg); }
.today-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); }
.today-title { font-size: var(--fs-md); font-weight: 600; }
.level { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-2); }
.ticks { display: flex; gap: var(--s-1); }
.tick { width: 16px; height: 4px; border-radius: 2px; background: var(--c-sunken-2); }
.tick.on { background: var(--c-ink); }
.streak { display: flex; gap: var(--s-6); margin-top: var(--s-5); padding-top: var(--s-5); border-top: var(--border); }
.streak-n { font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.today .stack-btns { margin-top: var(--s-5); }
.howto { margin-top: var(--s-6); display: grid; gap: var(--s-3); padding: 0; list-style: none; counter-reset: h; }
.howto li { display: grid; grid-template-columns: 24px 1fr; gap: var(--s-3); font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-ink-2); counter-increment: h; }
.howto li::before { content: counter(h); font-weight: 600; color: var(--c-ink); font-variant-numeric: tabular-nums; }

/* Progreso */
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s-1); }
.progress span { height: 4px; border-radius: 2px; background: var(--c-sunken-2); }
.progress .done { background: var(--c-ink); }
.progress .now { background: var(--c-accent); }

/* Ronda */
.round-head { margin-top: var(--s-5); margin-bottom: var(--s-5); }
.round-head .small { margin-top: var(--s-1); }
.round-head h2 { outline: none; }
.pair { display: grid; gap: var(--s-4); }
@media (min-width: 720px) { .pair { grid-template-columns: 1fr 1fr; } }

.opt {
  appearance: none; display: block; width: 100%; padding: 0; text-align: left; cursor: pointer;
  background: none; border: 2px solid transparent; border-radius: calc(var(--r-lg) + 4px);
  transition: border-color var(--dur) var(--ease);
}
.opt:disabled { cursor: default; }
.frame {
  position: relative; display: flex; justify-content: center; align-items: flex-start;
  padding: var(--s-6) var(--s-4) var(--s-5); background: var(--c-sunken); border-radius: var(--r-lg);
  transition: background var(--dur) var(--ease);
}
.opt:not(:disabled):hover .frame { background: var(--c-sunken-2); }
.opt.is-right { border-color: var(--c-ink); }
.opt.is-wrong { border-color: var(--c-line-strong); }
.opt.is-picked.is-wrong { border-color: var(--c-accent); }
.tag {
  position: absolute; top: var(--s-2); left: var(--s-3); display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; color: var(--c-ink-2);
}
.tag b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--c-surface); border: var(--border); font-weight: 600; color: var(--c-ink); }
.tag-note { font-weight: 500; }
.opt.is-right .tag-note { color: var(--c-ink); }
.opt.is-picked.is-wrong .tag-note { color: var(--c-accent); }

/* Medida */
.frame-solo { padding: var(--s-6) var(--s-4); }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); margin-top: var(--s-4); }
@media (min-width: 720px) { .choices { grid-template-columns: repeat(6, 1fr); } }
.choice {
  appearance: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 64px; padding: var(--s-2); border-radius: var(--r-md); background: var(--c-surface);
  border: 1px solid var(--c-line-strong); cursor: pointer; transition: border-color var(--dur) var(--ease);
}
.choice:not(:disabled):hover { border-color: var(--c-ink); }
.choice:disabled { cursor: default; }
.choice-n { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 650; font-variant-numeric: tabular-nums; }
.choice-n small { font-size: var(--fs-xs); font-weight: 500; color: var(--c-ink-3); margin-left: 2px; }
.choice-r { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--c-ink-3); }
.choice.is-right { border-color: var(--c-ink); border-width: 2px; }
.choice.is-picked:not(.is-right) { border-color: var(--c-accent); border-width: 2px; }
.choice.is-picked:not(.is-right) .choice-n { color: var(--c-accent); }

/* Barra de resultado */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--c-surface); border-top: var(--border);
  padding: var(--s-4) var(--gutter) calc(var(--s-4) + env(safe-area-inset-bottom));
}
.bar-in { max-width: calc(var(--w-page) - 2 * var(--gutter)); margin: 0 auto; display: grid; gap: var(--s-3); }
@media (min-width: 720px) { .bar-in { grid-template-columns: 1fr auto; align-items: center; gap: var(--s-5); } }
.bar-title { font-weight: 600; display: flex; gap: var(--s-2); align-items: baseline; }
.bar-pts { font-variant-numeric: tabular-nums; color: var(--c-ink-3); font-weight: 500; }
.bar-pts.got { color: var(--c-ink); }
.bar-text { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--c-ink-2); margin-top: var(--s-1); }
.bar .btn { width: 100%; }
@media (min-width: 720px) { .bar .btn { width: auto; min-width: 160px; } }
.bar-enter { animation: rise var(--dur) var(--ease); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Final */
.final { padding-top: var(--s-5); }
.score { display: flex; align-items: baseline; gap: var(--s-2); margin-top: var(--s-2); }
.score-n { font-size: var(--fs-num); line-height: var(--lh-num); font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.score-of { font-size: var(--fs-lg); color: var(--c-ink-3); font-variant-numeric: tabular-nums; }
.cells { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s-2); margin-top: var(--s-5); }
.cell { padding: var(--s-3) 0 0; border-top: 4px solid var(--c-sunken-2); }
.cell.full { border-top-color: var(--c-ink); }
.cell.part { border-top-color: var(--c-accent); }
.cell-r { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--c-ink-3); }
.cell-p { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin-top: var(--s-3); font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--c-ink-3); }
.legend span { display: inline-flex; align-items: center; gap: var(--s-2); }
.legend i { width: 12px; height: 4px; border-radius: 2px; background: var(--c-sunken-2); }
.legend i.full { background: var(--c-ink); } .legend i.part { background: var(--c-accent); }
.final .stack-btns { margin-top: var(--s-5); }
.copy-status { min-height: var(--lh-sm); margin-top: var(--s-2); }
.section { margin-top: var(--s-7); padding-top: var(--s-5); border-top: var(--border); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-3); margin-top: var(--s-4); }
.stat-n { font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-l { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--c-ink-3); margin-top: var(--s-1); }
.dist { display: grid; gap: var(--s-2); margin-top: var(--s-4); }
.dist-row { display: grid; grid-template-columns: 64px 1fr; gap: var(--s-3); align-items: center; font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--c-ink-2); font-variant-numeric: tabular-nums; }
.dist-bar { height: 20px; border-radius: 4px; background: var(--c-sunken-2); min-width: 24px; display: flex; align-items: center; justify-content: flex-end; padding: 0 var(--s-2); font-weight: 600; color: var(--c-ink); }
.dist-bar.on { background: var(--c-ink); color: #fff; }
.next { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); }
.next-t { font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.foot { margin-top: var(--s-8); padding: var(--s-5) 0; border-top: var(--border); }

/* ------- Componentes de los desafios ------- */
.cmp, .cmp * { box-sizing: border-box; }
.cmp {
  position: relative; display: block; flex: none; background: #fff; border: 1px solid #E2E2DE; border-radius: 12px;
  font-family: var(--font); color: #18181B; text-align: left; font-weight: 400; overflow: visible;
}
.cmp span { display: block; }
.cmp .cmp-in { display: flex; flex-direction: column; }
.cmp .row { display: flex; flex-direction: row; align-items: center; }
.cmp .row-top { align-items: flex-start; }
.cmp .col { display: flex; flex-direction: column; min-width: 0; }
.cmp .grow { flex: 1 1 0; min-width: 0; }
.cmp .al { position: relative; }
.cmp .g { flex: none; position: relative; }
.cmp .gh { align-self: stretch; }
.cmp .t-title { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: -0.01em; }
.cmp .t-h { font-size: 20px; line-height: 28px; font-weight: 650; letter-spacing: -0.02em; }
.cmp .t-body { font-size: 14px; line-height: 20px; color: #3F3F46; }
.cmp .t-muted { font-size: 14px; line-height: 20px; color: #6B6B73; }
.cmp .t-muted2 { color: #6B6B73; }
.cmp .t-strong { font-size: 14px; line-height: 20px; font-weight: 600; }
.cmp .t-xs { font-size: 12px; line-height: 16px; color: #6B6B73; }
.cmp .t-num { font-size: 16px; line-height: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cmp .t-label { font-size: 13px; line-height: 16px; font-weight: 500; color: #3F3F46; }
.cmp .t-price { font-size: 16px; line-height: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cmp .t-done { color: #8A8A92; text-decoration: line-through; }
.cmp .avatar { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 600; color: #2E2E33; }
.cmp .icon { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 15px; font-weight: 600; color: #2E2E33; }
.cmp .tone-0 { background: #ECE6DC; } .cmp .tone-1 { background: #DFE5EA; }
.cmp .tone-2 { background: #E6E1EC; } .cmp .tone-3 { background: #DFE8E1; }
.cmp .img { height: 80px; border-radius: 8px; display: grid; place-items: center; }
.cmp .shape { background: rgba(20, 20, 20, .14); }
.cmp .shape-circle { width: 40px; height: 40px; border-radius: 50%; }
.cmp .shape-square { width: 36px; height: 36px; border-radius: 6px; }
.cmp .shape-pill { width: 64px; height: 28px; border-radius: 14px; }
.cmp .shape-arch { width: 40px; height: 44px; border-radius: 20px 20px 4px 4px; }
.cmp .chip { height: 32px; padding: 0 12px; display: flex; align-items: center; border: 1px solid #E2E2DE; border-radius: 8px; font-size: 13px; line-height: 16px; white-space: nowrap; }
.cmp .chip-on { border-color: #18181B; font-weight: 600; }
.cmp .input { height: 40px; padding: 0 12px; display: flex; align-items: center; border: 1px solid #D6D6D1; border-radius: 8px; font-size: 14px; color: #3F3F46; white-space: nowrap; overflow: hidden; }
.cmp .b { position: relative; display: flex; align-items: center; height: 40px; border-radius: 8px; font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.cmp .b.sm { height: 32px; font-size: 13px; }
.cmp .b-pri { background: #18181B; color: #fff; }
.cmp .b-sec { background: #fff; color: #18181B; box-shadow: inset 0 0 0 1px #D6D6D1; }
.cmp .b-static { padding: 0 16px; justify-content: center; }
.cmp .b-static.sm { padding: 0 12px; }
.cmp .b.grow, .cmp .b.full { justify-content: center; }
.cmp .b.full { width: 100%; }
.cmp .b-t { position: relative; }
.cmp .check { width: 16px; height: 16px; flex: none; border-radius: 4px; box-shadow: inset 0 0 0 1.5px #C9C9C4; position: relative; }
.cmp .check-on { background: #18181B; box-shadow: none; }
.cmp .check-on::after { content: ''; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.cmp .tab { font-size: 14px; line-height: 20px; color: #6B6B73; white-space: nowrap; }
.cmp .tab-on { color: #18181B; font-weight: 600; }

/* Superposiciones de medida: ocultas hasta que se marcan */
.cmp .ov { position: absolute; display: none; pointer-events: none; z-index: 1; }
.cmp .ov-off { left: 0; top: 0; bottom: 0; }
.cmp .hl, .cmp .hl-q { background: var(--c-accent-soft); }
.cmp .ov.hl, .cmp .ov.hl-q { display: block; }
.cmp .hl-q { box-shadow: inset 0 0 0 1px var(--c-accent); background: var(--c-accent-soft); }
.cmp .ov-guide.hl { display: block; top: -8px; bottom: -8px; width: 0; border-left: 1px dashed var(--c-accent); background: none; }
.cmp .lbl::after {
  content: attr(data-v); position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 0 4px; border-radius: 4px; background: var(--c-accent); color: #fff;
  font-size: 11px; line-height: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cmp .gv.lbl::after { left: auto; right: -6px; transform: translate(100%, -50%); }
.cmp .gh.lbl::after, .cmp .ov-off.lbl::after { top: -4px; transform: translate(-50%, -100%); }
.cmp .lbl[data-v="0"]::after { display: none; }

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