/*
 * Point Kids 2.0. Lee solo tokens --pk-* (tokens.css).
 * Idea: "Tengo 100". El puntaje es una barra de vida que arranca llena;
 * los premios son muescas sobre esa barra. La audacia vive en el número
 * del puntaje (Bricolage Grotesque); todo lo demás queda sobrio.
 */

:root {
  --pk-font-score: "Bricolage Grotesque", var(--pk-font-display);
  --pk-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --pk-ease-move: cubic-bezier(0.77, 0, 0.175, 1);
  --pk-nav-h: 68px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--pk-bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--pk-bg);
  color: var(--pk-ink);
  font-family: var(--pk-font-body);
  font-size: var(--pk-text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

h1,
h2,
h3 {
  font-family: var(--pk-font-display);
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}
h1 {
  font-size: var(--pk-text-h1);
  font-weight: 900;
}
h2 {
  font-size: var(--pk-text-h2);
  font-weight: 800;
}
h3 {
  font-size: var(--pk-text-h3);
  font-weight: 800;
}
p {
  margin: 0;
}
a {
  color: var(--pk-accent);
  font-weight: 700;
  text-underline-offset: 3px;
}
code {
  font-family: var(--pk-font-score);
  font-weight: 700;
  font-size: 1.05em;
}

.i {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

.muted {
  color: var(--pk-ink-muted);
}
.small {
  font-size: var(--pk-text-label);
}
.num {
  font-family: var(--pk-font-score);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -0.03em;
}

:focus-visible {
  outline: 3px solid var(--pk-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Estructura ---------- */

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--pk-space-4) var(--pk-space-4)
    calc(var(--pk-nav-h) + var(--pk-space-6) + env(safe-area-inset-bottom));
  display: grid;
  gap: var(--pk-space-5);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pk-space-3);
  min-height: var(--pk-tap-min);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--pk-space-2);
  font-family: var(--pk-font-display);
  font-weight: 900;
  font-size: 1.125rem;
  color: var(--pk-ink);
  text-decoration: none;
}
.coin {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--pk-points);
  color: var(--pk-on-points);
  font-family: var(--pk-font-score);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / 14%);
}

.who {
  display: flex;
  align-items: center;
  gap: var(--pk-space-2);
  min-width: 0;
  color: var(--pk-ink-muted);
  font-size: var(--pk-text-label);
  font-weight: 600;
}
.who span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role {
  flex: none;
  padding: 2px 10px;
  border-radius: var(--pk-radius-pill);
  background: var(--pk-surface);
  border: 1px solid var(--pk-line);
  color: var(--pk-ink);
  font-weight: 700;
}

.page-head {
  display: grid;
  gap: 4px;
}
.page-head h1 {
  font-size: clamp(1.875rem, 7vw, 2.75rem);
  letter-spacing: -0.02em;
}
.page-head p {
  color: var(--pk-ink-muted);
  font-weight: 600;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--pk-tap-min);
  color: var(--pk-ink-muted);
  text-decoration: none;
}

.grid {
  display: grid;
  gap: var(--pk-space-5);
}
@media (min-width: 760px) {
  .grid.two {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    align-items: start;
  }
}

.panel {
  background: var(--pk-surface);
  border: 1px solid var(--pk-line);
  border-radius: var(--pk-radius-xl);
  padding: var(--pk-space-5);
  display: grid;
  gap: var(--pk-space-4);
  min-width: 0;
}

/* ---------- Navegación ---------- */

nav.tabs-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  background: var(--pk-surface);
  border-top: 1px solid var(--pk-line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs-nav .inner {
  max-width: 640px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
nav.tabs-nav a {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  height: var(--pk-nav-h);
  color: var(--pk-ink-muted);
  font-size: var(--pk-text-nav);
  font-weight: 700;
  text-decoration: none;
}
nav.tabs-nav a .i {
  width: 24px;
  height: 24px;
}
nav.tabs-nav a.active {
  color: var(--pk-accent);
}
nav.tabs-nav a.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 30%;
  right: 30%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--pk-accent);
}
.badge {
  position: absolute;
  top: 8px;
  left: calc(50% + 6px);
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--pk-radius-pill);
  background: var(--pk-pending-solid);
  color: var(--pk-on-pending-solid);
  font-family: var(--pk-font-score);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

@media (min-width: 1024px) {
  .app {
    display: grid;
    grid-template-columns: 240px 1fr;
    max-width: 1360px;
    margin: 0 auto;
  }
  nav.tabs-nav {
    position: sticky;
    top: 0;
    height: 100dvh;
    border-top: 0;
    border-right: 1px solid var(--pk-line);
    background: transparent;
    padding: 96px var(--pk-space-4) 0;
  }
  nav.tabs-nav .inner {
    grid-template-columns: 1fr;
    gap: var(--pk-space-1);
  }
  nav.tabs-nav a {
    grid-auto-flow: column;
    justify-content: start;
    gap: var(--pk-space-3);
    height: 48px;
    padding: 0 var(--pk-space-4);
    border-radius: var(--pk-radius-md);
    font-size: 1rem;
  }
  nav.tabs-nav a.active {
    background: var(--pk-surface);
    box-shadow: var(--pk-shadow-1);
  }
  nav.tabs-nav a.active::before {
    display: none;
  }
  .badge {
    position: static;
  }
  .page {
    padding-bottom: var(--pk-space-8);
    width: 100%;
  }
}

/* ---------- Controles ---------- */

button,
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--pk-space-2);
  min-height: 48px;
  padding: 0 var(--pk-space-5);
  border: 0;
  border-radius: var(--pk-radius-pill);
  background: var(--pk-accent);
  color: var(--pk-accent-ink);
  font: 800 1rem/1 var(--pk-font-display);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms var(--pk-ease-out),
    background-color 200ms var(--pk-ease-out),
    opacity 200ms;
}
button:active,
.btn:active {
  transform: scale(0.97);
  transition-duration: 100ms;
}
button:disabled {
  opacity: 0.55;
  cursor: progress;
}
button.ghost,
.btn.ghost {
  background: transparent;
  color: var(--pk-ink);
  box-shadow: inset 0 0 0 1.5px var(--pk-line);
}
button.text {
  min-height: var(--pk-tap-min);
  padding: 0 var(--pk-space-3);
  background: transparent;
  color: var(--pk-ink-muted);
}
button.danger {
  min-height: var(--pk-tap-min);
  padding: 0 var(--pk-space-3);
  background: transparent;
  color: var(--pk-missed);
}
@media (hover: hover) {
  button.ghost:hover {
    box-shadow: inset 0 0 0 1.5px var(--pk-ink-muted);
  }
  button.danger:hover {
    background: var(--pk-missed-soft);
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pk-space-3);
  align-items: center;
}

form {
  display: grid;
  gap: var(--pk-space-4);
}
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field > span,
fieldset > legend {
  font-size: var(--pk-text-label);
  font-weight: 700;
  padding: 0;
  margin-bottom: 6px;
}
.field small,
.hint {
  color: var(--pk-ink-muted);
  font-size: var(--pk-text-caption);
}
.row {
  display: grid;
  gap: var(--pk-space-3);
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--pk-space-4);
  border: 1.5px solid var(--pk-line);
  border-radius: var(--pk-radius-md);
  background: var(--pk-bg);
  color: var(--pk-ink);
  font: 600 1rem var(--pk-font-body);
  transition: border-color 160ms var(--pk-ease-out);
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--pk-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pk-accent) 25%, transparent);
}

/* Chips de selección (hijos, días) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pk-space-2);
}
.chip {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: var(--pk-tap-min);
  min-height: var(--pk-tap-min);
  padding: 0 var(--pk-space-4);
  border-radius: var(--pk-radius-pill);
  border: 1.5px solid var(--pk-line);
  background: var(--pk-surface);
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition:
    background-color 160ms var(--pk-ease-out),
    transform 120ms var(--pk-ease-out);
}
.chip:active {
  transform: scale(0.95);
}
.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  min-height: 0;
  cursor: pointer;
}
.chip:has(input:checked) {
  background: var(--pk-ink);
  border-color: var(--pk-ink);
  color: var(--pk-bg);
}
.chip:has(input:focus-visible) {
  outline: 3px solid var(--pk-accent);
  outline-offset: 2px;
}

/* Peso 1 a 5 */
.weight {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--pk-radius-pill);
  background: var(--pk-bg);
  border: 1px solid var(--pk-line);
}
.weight button,
.weight label {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--pk-ink-muted);
  font: 800 1rem var(--pk-font-score);
  cursor: pointer;
}
.weight input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  min-height: 0;
  cursor: pointer;
}
.weight .on,
.weight label:has(input:checked) {
  background: var(--pk-ink);
  color: var(--pk-bg);
}
.weight label:has(input:focus-visible) {
  outline: 3px solid var(--pk-accent);
}

.ai-hint {
  display: flex;
  gap: var(--pk-space-2);
  align-items: start;
  padding: var(--pk-space-3) var(--pk-space-4);
  border-radius: var(--pk-radius-md);
  background: color-mix(in srgb, var(--pk-accent) 10%, var(--pk-surface));
  color: var(--pk-ink);
  font-size: var(--pk-text-label);
  font-weight: 600;
}
.ai-hint[hidden] {
  display: none;
}
.ai-hint .i {
  color: var(--pk-accent);
  margin-top: 1px;
}

/* ---------- Barra de vida ---------- */

.life {
  position: relative;
  padding-top: 30px;
}
.life .track {
  position: relative;
  height: 22px;
  border-radius: var(--pk-radius-pill);
  background: color-mix(in srgb, currentColor 14%, transparent);
  overflow: hidden;
}
.life .fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--pk-points);
  box-shadow: inset 0 -5px 0 rgb(0 0 0 / 12%);
  transform-origin: left center;
}
.life .fill::after {
  /* brillo superior: volumen de barra de juego */
  content: "";
  position: absolute;
  inset: 4px 10px auto;
  height: 4px;
  border-radius: 4px;
  background: rgb(255 255 255 / 45%);
}
.life .notch {
  position: absolute;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  grid-template-rows: 28px 1fr;
  pointer-events: none;
}
.life .notch span {
  font-size: 1.05rem;
  line-height: 24px;
  filter: grayscale(1);
  opacity: 0.6;
}
.life .notch.reached span {
  filter: none;
  opacity: 1;
}
.life .notch::after {
  content: "";
  width: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.4;
}

/* ---------- Tarjeta de hijo (Hoy) ---------- */

.kid {
  display: grid;
  border-radius: 28px;
  overflow: hidden;
  background: var(--pk-surface);
  border: 1px solid var(--pk-line);
  color: var(--pk-ink);
  min-width: 0;
}
.kid .hero {
  display: grid;
  gap: var(--pk-space-3);
  padding: var(--pk-space-5);
  background: var(--pk-surface-strong);
  color: var(--pk-on-strong);
}
.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pk-space-3);
}
.hero-top h2 {
  font-size: 1.375rem;
}
.hero-top a {
  display: inline-flex;
  align-items: center;
  min-height: var(--pk-tap-min);
  font-size: var(--pk-text-label);
  color: var(--pk-on-strong-muted);
}

.score {
  display: flex;
  align-items: baseline;
  gap: var(--pk-space-2);
  line-height: 0.9;
}
.score .num {
  font-size: clamp(3.5rem, 15vw, 4.75rem);
  color: var(--pk-points);
}
.score .of {
  font-family: var(--pk-font-score);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--pk-on-strong-muted);
}
.score.xl .num {
  font-size: clamp(5.5rem, 30vw, 10rem);
  letter-spacing: -0.05em;
}
.score.xl .of {
  font-size: clamp(1.25rem, 5vw, 2rem);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pk-space-2);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: var(--pk-radius-pill);
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: var(--pk-text-label);
  font-weight: 700;
}
.pill .i {
  width: 16px;
  height: 16px;
}
.pill.flame .i {
  color: var(--pk-points);
}
.pill.warn {
  background: var(--pk-pending-solid);
  color: var(--pk-on-pending-solid);
}

/* Días del periodo */
.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.day {
  display: grid;
  place-items: center;
  height: 40px;
  border-radius: 12px;
  font-family: var(--pk-font-score);
  font-weight: 800;
  font-size: 0.875rem;
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.day.perfect {
  background: var(--pk-done);
  color: var(--pk-on-status);
}
.day.missed {
  background: var(--pk-missed);
  color: var(--pk-on-status);
}
.day.pending {
  background: var(--pk-pending-solid);
  color: var(--pk-on-pending-solid);
}
.day.excluded {
  text-decoration: line-through;
  opacity: 0.55;
}
.day.future {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px
    color-mix(in srgb, currentColor 28%, transparent);
  opacity: 0.7;
}
.day.today {
  outline: 2.5px solid currentColor;
  outline-offset: 2px;
}

/* ---------- Filas de tarea ---------- */

.tasks {
  display: grid;
  gap: 2px;
  padding: var(--pk-space-2);
}
.task {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--pk-space-3);
  padding: var(--pk-space-3) var(--pk-space-3) var(--pk-space-3)
    var(--pk-space-4);
  border-radius: 18px;
  transition: background-color 200ms var(--pk-ease-out);
}
.task .name {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.task .name strong {
  font-family: var(--pk-font-display);
  font-weight: 800;
  font-size: 1.0625rem;
  line-height: 1.25;
}
.task .value {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--pk-space-2);
  color: var(--pk-ink-muted);
  font-size: var(--pk-text-label);
  font-weight: 700;
}
.pips {
  display: inline-flex;
  gap: 3px;
}
.pips i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pk-line);
}
.pips i.on {
  background: var(--pk-ink-muted);
}

.task.pending {
  background: var(--pk-pending-soft);
}
.task.pending::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--pk-pending-solid);
}
.task.missed .value b {
  color: var(--pk-missed);
}
.task.done .value b {
  color: var(--pk-done);
}

.marks {
  display: flex;
  gap: var(--pk-space-2);
}
.mark {
  width: 54px;
  min-height: 54px;
  padding: 0;
  border-radius: 18px;
  background: var(--pk-surface);
  color: var(--pk-ink-muted);
  box-shadow: inset 0 0 0 1.5px var(--pk-line);
}
.mark .i {
  width: 26px;
  height: 26px;
  stroke-width: 2.8;
}
.mark.done.on {
  background: var(--pk-done);
  color: var(--pk-on-status);
  box-shadow: none;
}
.mark.missed.on {
  background: var(--pk-missed);
  color: var(--pk-on-status);
  box-shadow: none;
}
.mark.pop {
  animation: stamp 260ms var(--pk-ease-out);
}
@keyframes stamp {
  from {
    transform: scale(0.82) rotate(-6deg);
  }
  to {
    transform: none;
  }
}
@media (hover: hover) {
  .mark.done:not(.on):hover {
    color: var(--pk-done);
    box-shadow: inset 0 0 0 1.5px var(--pk-done);
  }
  .mark.missed:not(.on):hover {
    color: var(--pk-missed);
    box-shadow: inset 0 0 0 1.5px var(--pk-missed);
  }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--pk-radius-pill);
  font-size: var(--pk-text-label);
  font-weight: 800;
  white-space: nowrap;
}
.status .i {
  width: 16px;
  height: 16px;
  stroke-width: 3;
}
.status.done {
  background: var(--pk-done-soft);
  color: var(--pk-done);
}
.status.missed {
  background: var(--pk-missed-soft);
  color: var(--pk-missed);
}
.status.pending {
  background: var(--pk-pending-solid);
  color: var(--pk-on-pending-solid);
}

.empty {
  display: grid;
  justify-items: start;
  gap: var(--pk-space-3);
  padding: var(--pk-space-4);
  color: var(--pk-ink-muted);
  font-weight: 600;
}

/* ---------- Alerta de pendientes ---------- */

.alert {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--pk-space-3) var(--pk-space-4);
  padding: var(--pk-space-4) var(--pk-space-5);
  border-radius: var(--pk-radius-xl);
  background: var(--pk-pending-solid);
  color: var(--pk-on-pending-solid);
}
.alert .num {
  font-size: 2.75rem;
  line-height: 1;
}
.alert p {
  flex: 1 1 160px;
  font-weight: 700;
  line-height: 1.3;
}
.alert .btn {
  background: var(--pk-on-pending-solid);
  color: var(--pk-pending-solid);
}

/* ---------- Listas ---------- */

.list {
  display: grid;
}
.item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--pk-space-3);
  padding: var(--pk-space-4) 0;
  border-top: 1px solid var(--pk-line);
}
.item:first-child {
  border-top: 0;
  padding-top: 0;
}
.item .grow {
  flex: 1 1 200px;
  display: grid;
  gap: 4px;
  min-width: 0;
}
.item .grow strong {
  font-family: var(--pk-font-display);
  font-weight: 800;
  font-size: 1.0625rem;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  padding: 2px 10px;
  border-radius: var(--pk-radius-pill);
  background: var(--pk-bg);
  border: 1px solid var(--pk-line);
  color: var(--pk-ink-muted);
  font-size: 0.8125rem;
  font-weight: 700;
}
.why {
  display: flex;
  gap: 6px;
  color: var(--pk-ink-muted);
  font-size: var(--pk-text-label);
}
.why .i {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  color: var(--pk-accent);
}

/* ---------- Escalera de premios ---------- */

.ladder {
  position: relative;
  display: grid;
  gap: var(--pk-space-3);
  padding-left: 36px;
}
.ladder::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 20px;
  bottom: 20px;
  width: 4px;
  border-radius: 2px;
  background: var(--pk-line);
}
.rung {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--pk-space-3);
  min-height: 64px;
  padding: var(--pk-space-3) var(--pk-space-4);
  border-radius: 20px;
  background: var(--pk-bg);
  border: 1.5px solid var(--pk-line);
}
.rung::before {
  content: "";
  position: absolute;
  left: -32px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--pk-surface);
  border: 4px solid var(--pk-line);
}
.rung .pct {
  font-family: var(--pk-font-score);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  min-width: 3.2ch;
}
.rung .what {
  display: flex;
  align-items: center;
  gap: var(--pk-space-2);
  min-width: 0;
  font-weight: 800;
  font-family: var(--pk-font-display);
}
.rung .what .emo {
  font-size: 1.5rem;
}
.rung.reached {
  background: color-mix(in srgb, var(--pk-points) 24%, var(--pk-surface));
  border-color: var(--pk-points);
}
.rung.reached::before {
  background: var(--pk-points);
  border-color: var(--pk-points);
}
.rung.locked .what,
.rung.locked .pct {
  opacity: 0.72;
}
.you {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 28px;
  gap: var(--pk-space-2);
  font-weight: 800;
  font-family: var(--pk-font-display);
}
.you::before {
  content: "";
  position: absolute;
  left: -34px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--pk-points);
  box-shadow: 0 0 0 4px var(--pk-surface);
}
.you b {
  font-family: var(--pk-font-score);
}

/* ---------- Tablero del hijo ---------- */

.kidboard .hero {
  display: grid;
  gap: var(--pk-space-4);
  padding: var(--pk-space-6) var(--pk-space-5) var(--pk-space-5);
  border-radius: 32px;
  background: var(--pk-surface-strong);
  color: var(--pk-on-strong);
}
.kidboard .hello {
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 900;
}
.kidboard .motto {
  color: var(--pk-on-strong-muted);
  font-weight: 700;
}
.next {
  display: flex;
  align-items: center;
  gap: var(--pk-space-3);
  padding: var(--pk-space-3) var(--pk-space-4);
  border-radius: 20px;
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-weight: 700;
}
.next .emo {
  font-size: 2rem;
  line-height: 1;
}
.next b {
  font-family: var(--pk-font-display);
  font-weight: 900;
}
.next.won {
  background: var(--pk-points);
  color: var(--pk-on-points);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pk-space-3);
  color: var(--pk-ink-muted);
  font-size: var(--pk-text-caption);
  font-weight: 600;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.history {
  display: grid;
}
.history .h {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--pk-space-3);
  padding: var(--pk-space-3) 0;
  border-top: 1px solid var(--pk-line);
}
.history .h:first-child {
  border-top: 0;
}
.history .h .num {
  font-size: 1.5rem;
}

/* ---------- Acceso ---------- */

.gate {
  min-height: 100dvh;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: var(--pk-space-5);
  padding: 0 var(--pk-space-4) var(--pk-space-7);
}
.stage {
  width: calc(100% + var(--pk-space-4) * 2);
  display: grid;
  justify-items: center;
  gap: var(--pk-space-2);
  padding: var(--pk-space-7) var(--pk-space-4) var(--pk-space-6);
  border-radius: 0 0 40px 40px;
  background: var(--pk-surface-strong);
  color: var(--pk-on-strong);
  text-align: center;
  overflow: hidden;
}
.giant {
  font-family: var(--pk-font-score);
  font-weight: 800;
  font-size: clamp(7rem, 38vw, 13rem);
  line-height: 0.82;
  letter-spacing: -0.06em;
  color: var(--pk-points);
  font-variant-numeric: tabular-nums;
}
.tagline {
  font-family: var(--pk-font-display);
  font-weight: 900;
  font-size: clamp(1.25rem, 5vw, 1.75rem);
}
.stage .sub {
  color: var(--pk-on-strong-muted);
  font-weight: 600;
  max-width: 34ch;
}
.stage .life {
  width: min(320px, 80%);
  margin-top: var(--pk-space-3);
}
.box {
  width: min(440px, 100%);
  display: grid;
  gap: var(--pk-space-4);
}
@media (min-width: 900px) {
  .gate {
    grid-template-columns: 1fr minmax(380px, 460px);
    align-content: center;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    gap: var(--pk-space-7);
    padding: var(--pk-space-6);
  }
  .stage {
    width: 100%;
    min-height: 560px;
    align-content: center;
    border-radius: 40px;
  }
}

.switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: var(--pk-radius-pill);
  background: var(--pk-surface);
  border: 1px solid var(--pk-line);
}
.switch button {
  background: transparent;
  color: var(--pk-ink-muted);
}
.switch button[aria-pressed="true"] {
  background: var(--pk-ink);
  color: var(--pk-bg);
}

.pindots {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: var(--pk-space-2) 0;
}
.pindots span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2.5px var(--pk-line);
  transition:
    background-color 120ms,
    transform 160ms var(--pk-ease-out);
}
.pindots span.on {
  background: var(--pk-points);
  box-shadow: none;
  transform: scale(1.15);
}
.pindots.shake {
  animation: shake 320ms var(--pk-ease-move);
}
@keyframes shake {
  25% {
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(7px);
  }
  75% {
    transform: translateX(-4px);
  }
}
.pinpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.pinpad button {
  min-height: 68px;
  border-radius: 22px;
  background: var(--pk-surface);
  color: var(--pk-ink);
  box-shadow:
    inset 0 0 0 1.5px var(--pk-line),
    inset 0 -4px 0 var(--pk-line);
  font: 800 1.75rem var(--pk-font-score);
}
.pinpad button.go {
  background: var(--pk-accent);
  color: var(--pk-accent-ink);
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / 18%);
}
.pinpad button .i {
  width: 28px;
  height: 28px;
}

/* ---------- Selector de tema ---------- */

.themes {
  display: grid;
  gap: var(--pk-space-4);
}
.themes h3 {
  font-size: var(--pk-text-label);
  color: var(--pk-ink-muted);
}
.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--pk-space-2);
  margin-top: var(--pk-space-2);
}
.swatch {
  display: grid;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  border-radius: 18px;
  background: var(--pk-bg);
  color: var(--pk-ink);
  box-shadow: inset 0 0 0 1.5px var(--pk-line);
  font: 800 0.8125rem var(--pk-font-display);
  justify-items: start;
}
.swatch .sample {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--pk-surface-strong);
}
.swatch .sample i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.swatch .sample i:nth-child(1) {
  background: var(--pk-points);
}
.swatch .sample i:nth-child(2) {
  background: var(--pk-accent);
}
.swatch .sample i:nth-child(3) {
  background: var(--pk-surface);
}
.swatch[aria-pressed="true"] {
  box-shadow: inset 0 0 0 3px var(--pk-accent);
}

/* ---------- Toast y carga ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(
    var(--pk-nav-h) + var(--pk-space-4) + env(safe-area-inset-bottom)
  );
  z-index: 20;
  width: max-content;
  max-width: min(92vw, 480px);
  padding: 14px 20px;
  border-radius: 18px;
  background: var(--pk-ink);
  color: var(--pk-bg);
  font-weight: 700;
  box-shadow: var(--pk-shadow-2);
  opacity: 0;
  transform: translate(-50%, 16px) scale(0.96);
  pointer-events: none;
  transition:
    opacity 200ms var(--pk-ease-out),
    transform 260ms var(--pk-ease-out);
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (min-width: 1024px) {
  #toast {
    bottom: var(--pk-space-6);
  }
}

.loading {
  display: grid;
  place-items: center;
  min-height: 60dvh;
}
.loading .coin {
  width: 56px;
  height: 56px;
  font-size: 1.125rem;
  animation: flip 1.1s var(--pk-ease-move) infinite;
}
@keyframes flip {
  50% {
    transform: rotateY(180deg);
  }
  to {
    transform: rotateY(360deg);
  }
}

.view-in {
  animation: view-in 220ms var(--pk-ease-out);
}
@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* =====================================================================
 * Piel "valle": juego de granja en pixel art (estilo inspirado, original).
 * Marcos de madera con esquinas en escalón, pergamino adentro, tipografía
 * pixel en títulos y números. Los colores siguen saliendo del tema.
 * ===================================================================== */

:root {
  --pk-font-display: "Pixelify Sans", "Nunito", system-ui, sans-serif;
  --pk-font-score: "Pixelify Sans", "Nunito", system-ui, sans-serif;
  --px: 4px;
  --notch: polygon(
    var(--px) 0,
    calc(100% - var(--px)) 0,
    calc(100% - var(--px)) var(--px),
    100% var(--px),
    100% calc(100% - var(--px)),
    calc(100% - var(--px)) calc(100% - var(--px)),
    calc(100% - var(--px)) 100%,
    var(--px) 100%,
    var(--px) calc(100% - var(--px)),
    0 calc(100% - var(--px)),
    0 var(--px),
    var(--px) var(--px)
  );
}

:root,
[data-theme] {
  --wood-dark: color-mix(in srgb, var(--pk-surface-strong) 62%, #000);
  --wood: color-mix(in srgb, var(--pk-surface-strong) 55%, var(--pk-accent));
  --wood-light: color-mix(in srgb, var(--pk-surface-strong) 35%, var(--pk-points));
}
[data-theme="valle"] {
  --wood-dark: #3a1f0d;
  --wood: #a85a24;
  --wood-light: #e29a4c;
}

/* césped con textura pixel muy suave */
body {
  background-color: var(--pk-bg);
  background-image:
    linear-gradient(45deg, rgb(0 0 0 / 3.5%) 25%, transparent 25% 75%, rgb(0 0 0 / 3.5%) 75%),
    linear-gradient(45deg, rgb(0 0 0 / 3.5%) 25%, transparent 25% 75%, rgb(0 0 0 / 3.5%) 75%);
  background-size: 16px 16px;
  background-position:
    0 0,
    8px 8px;
}

h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: 0;
}
.page-head h1 {
  color: var(--pk-ink);
  text-shadow: 3px 3px 0 color-mix(in srgb, var(--pk-surface) 70%, transparent);
}
.num,
.score .num,
.giant,
.rung .pct {
  font-weight: 700;
  letter-spacing: 0;
}

/* Marco de madera: borde oscuro, veta media, filo claro, pergamino */
.panel,
.kid,
.box > .panel,
.rung,
.alert,
.next,
.swatch,
.switch {
  border-radius: 0;
  clip-path: var(--notch);
}
.panel,
.kid {
  border: 0;
  background: var(--pk-surface);
  box-shadow:
    inset 0 0 0 var(--px) var(--wood-dark),
    inset 0 0 0 calc(var(--px) * 2) var(--wood),
    inset 0 0 0 calc(var(--px) * 3) var(--wood-light),
    inset 0 calc(var(--px) * -4) 0 calc(var(--px) * 3) color-mix(in srgb, var(--wood-dark) 12%, transparent);
  padding: calc(var(--pk-space-5) + var(--px) * 3);
}
.kid {
  padding: calc(var(--px) * 3);
}
.kid .hero,
.kidboard .hero,
.stage {
  border-radius: 0;
  clip-path: var(--notch);
  background: var(--pk-surface-strong);
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 14px,
    rgb(0 0 0 / 12%) 14px 16px
  );
  box-shadow:
    inset 0 0 0 var(--px) var(--wood-dark),
    inset 0 var(--px) 0 calc(var(--px) * 2) rgb(255 255 255 / 8%);
}
.score .num,
.giant {
  text-shadow:
    var(--px) var(--px) 0 var(--wood-dark),
    calc(var(--px) * -1) 0 0 var(--wood-dark),
    0 calc(var(--px) * -1) 0 var(--wood-dark);
}

/* Botones de madera que se hunden al tocar */
button,
.btn {
  border-radius: 0;
  clip-path: var(--notch);
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow:
    inset 0 0 0 3px var(--wood-dark),
    inset 0 -6px 0 3px color-mix(in srgb, #000 22%, transparent),
    inset 0 3px 0 3px rgb(255 255 255 / 22%);
  padding-bottom: 4px;
}
button:active,
.btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 0 0 3px var(--wood-dark),
    inset 0 -2px 0 3px color-mix(in srgb, #000 22%, transparent);
}
button.ghost,
.btn.ghost {
  background: var(--pk-surface);
  color: var(--pk-ink);
  box-shadow:
    inset 0 0 0 3px var(--wood-dark),
    inset 0 -6px 0 3px var(--pk-line);
}
button.text,
button.danger {
  clip-path: none;
  box-shadow: none;
  padding-bottom: 0;
}
.switch {
  box-shadow: inset 0 0 0 3px var(--wood-dark);
  border: 0;
  padding: 6px;
}
.switch button {
  box-shadow: none;
}
.switch button[aria-pressed="true"] {
  background: var(--wood);
  color: #fff3d6;
  box-shadow:
    inset 0 0 0 3px var(--wood-dark),
    inset 0 -5px 0 3px rgb(0 0 0 / 20%);
}

input,
select {
  border-radius: 0;
  border: 3px solid var(--wood-dark);
  background: color-mix(in srgb, var(--pk-surface) 60%, #fff);
  box-shadow: inset 0 3px 0 rgb(0 0 0 / 8%);
}
.chip {
  border-radius: 0;
  clip-path: var(--notch);
  border: 3px solid var(--wood-dark);
  font-family: var(--pk-font-display);
  font-weight: 700;
}
.chip:has(input:checked) {
  background: var(--pk-accent);
  border-color: var(--wood-dark);
  color: var(--pk-accent-ink);
}
.weight {
  border-radius: 0;
  border: 3px solid var(--wood-dark);
}
.weight button,
.weight label {
  border-radius: 0;
  clip-path: none;
  box-shadow: none;
}
.weight .on,
.weight label:has(input:checked) {
  background: var(--pk-accent);
  color: var(--pk-accent-ink);
}

/* Barra de energía: color según cuánto queda */
.life .track {
  border-radius: 0;
  height: 26px;
  background: var(--wood-dark);
  box-shadow: inset 0 0 0 var(--px) var(--wood-dark);
  clip-path: var(--notch);
}
.life .fill {
  inset: var(--px);
  border-radius: 0;
  background: #5fd04a;
  box-shadow: inset 0 -6px 0 rgb(0 0 0 / 18%);
}
.life[data-level="mid"] .fill {
  background: #f2c53d;
}
.life[data-level="low"] .fill {
  background: #ef6b3a;
}
.life .fill::after {
  inset: 4px 8px auto;
  border-radius: 0;
}
.life .notch::after {
  width: 4px;
  border-radius: 0;
  background: var(--wood-dark);
  opacity: 0.9;
}

.day {
  border-radius: 0;
  clip-path: var(--notch);
}
.task {
  border-radius: 0;
}
.task.pending {
  background: var(--pk-pending-soft);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pk-pending-solid) 55%, transparent);
}
.task.pending::before {
  border-radius: 0;
  top: 0;
  bottom: 0;
  width: 6px;
}
.task + .task {
  border-top: 2px dashed color-mix(in srgb, var(--pk-line) 80%, transparent);
}
.mark {
  border-radius: 0;
  background: color-mix(in srgb, var(--pk-surface) 50%, #fff);
}
.mark.done.on,
.mark.missed.on {
  box-shadow:
    inset 0 0 0 3px var(--wood-dark),
    inset 0 -6px 0 3px rgb(0 0 0 / 22%);
}
.status,
.pill,
.tag,
.role,
.badge {
  border-radius: 0;
  clip-path: var(--notch);
  font-family: var(--pk-font-display);
}
.rung {
  border: 0;
  box-shadow:
    inset 0 0 0 3px var(--wood-dark),
    inset 0 -5px 0 3px var(--pk-line);
}
.rung.reached {
  box-shadow:
    inset 0 0 0 3px var(--wood-dark),
    inset 0 -5px 0 3px color-mix(in srgb, var(--pk-points) 60%, #a86a00);
}
.rung::before,
.you::before {
  border-radius: 0;
  clip-path: var(--notch);
}
.ladder::before {
  border-radius: 0;
  width: 6px;
  left: 12px;
  background: var(--wood);
  box-shadow: 0 0 0 2px var(--wood-dark);
}
.alert {
  box-shadow:
    inset 0 0 0 var(--px) var(--wood-dark),
    inset 0 -6px 0 var(--px) rgb(0 0 0 / 15%);
}
.alert .btn {
  background: var(--pk-surface);
  color: var(--pk-ink);
}
.pinpad button {
  border-radius: 0;
  font-size: 2rem;
}
.pindots span {
  border-radius: 0;
  clip-path: var(--notch);
}
.swatch {
  border-radius: 0;
  box-shadow: inset 0 0 0 3px var(--wood-dark);
}
.swatch .sample {
  border-radius: 0;
}
.swatch .sample i {
  border-radius: 0;
}
.swatch[aria-pressed="true"] {
  box-shadow:
    inset 0 0 0 3px var(--wood-dark),
    inset 0 0 0 6px var(--pk-points);
}
#toast {
  border-radius: 0;
  clip-path: var(--notch);
  background: var(--pk-surface);
  color: var(--pk-ink);
  box-shadow:
    inset 0 0 0 var(--px) var(--wood-dark),
    inset 0 0 0 calc(var(--px) * 2) var(--wood);
  padding: 18px 24px;
  font-family: var(--pk-font-display);
}
nav.tabs-nav {
  background: var(--pk-surface-strong);
  border-top: var(--px) solid var(--wood-dark);
}
nav.tabs-nav a {
  color: var(--pk-on-strong-muted);
  font-family: var(--pk-font-display);
}
nav.tabs-nav a.active {
  color: var(--pk-points);
}
nav.tabs-nav a.active::before {
  border-radius: 0;
  background: var(--pk-points);
  height: var(--px);
}
@media (min-width: 1024px) {
  nav.tabs-nav {
    background: var(--pk-surface-strong);
    border-right: var(--px) solid var(--wood-dark);
  }
  nav.tabs-nav a {
    border-radius: 0;
  }
  nav.tabs-nav a.active {
    background: color-mix(in srgb, #000 22%, transparent);
    box-shadow: none;
  }
}

/* Logo */
.logo {
  display: block;
  width: auto;
  image-rendering: pixelated;
}
.brand .logo {
  height: 40px;
}
.stage .logo {
  height: clamp(64px, 18vw, 96px);
  margin-bottom: var(--pk-space-3);
}
.coin {
  border-radius: 0;
  clip-path: var(--notch);
}

/* =====================================================================
 * Piel "bloques": mundo de cubos (estilo inspirado, original).
 * Esquinas rectas, bisel claro arriba e izquierda y oscuro abajo y a la
 * derecha, tierra con pasto en el héroe, barra de experiencia por bloques.
 * Se activa con :root[data-skin="bloques"]; los colores siguen del tema.
 * ===================================================================== */

:root[data-skin="bloques"] {
  --pk-font-display: "Silkscreen", "Pixelify Sans", system-ui, sans-serif;
  --pk-font-score: "Silkscreen", "Pixelify Sans", system-ui, sans-serif;
  --blk-line: #111;
  --blk-hi: rgb(255 255 255 / 55%);
  --blk-lo: rgb(0 0 0 / 38%);
  --bevel:
    inset 0 0 0 2px var(--blk-line),
    inset 4px 4px 0 2px var(--blk-hi),
    inset -4px -4px 0 2px var(--blk-lo);
  --bevel-in:
    inset 0 0 0 2px var(--blk-line),
    inset 4px 4px 0 2px var(--blk-lo),
    inset -4px -4px 0 2px var(--blk-hi);
  --dirt: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' shape-rendering='crispEdges'%3E%3Cg fill='%23000' fill-opacity='.16'%3E%3Crect x='1' y='2' width='2' height='1'/%3E%3Crect x='9' y='1' width='1' height='2'/%3E%3Crect x='5' y='6' width='2' height='2'/%3E%3Crect x='13' y='5' width='2' height='1'/%3E%3Crect x='2' y='11' width='1' height='2'/%3E%3Crect x='10' y='10' width='2' height='1'/%3E%3Crect x='14' y='13' width='1' height='2'/%3E%3Crect x='6' y='14' width='2' height='1'/%3E%3C/g%3E%3Cg fill='%23fff' fill-opacity='.1'%3E%3Crect x='4' y='0' width='1' height='1'/%3E%3Crect x='12' y='3' width='1' height='1'/%3E%3Crect x='0' y='7' width='1' height='1'/%3E%3Crect x='8' y='8' width='1' height='1'/%3E%3Crect x='3' y='15' width='1' height='1'/%3E%3Crect x='11' y='13' width='1' height='1'/%3E%3C/g%3E%3C/svg%3E");
}

:root[data-skin="bloques"] body {
  background-color: var(--pk-bg);
  background-image: var(--dirt);
  background-size: 64px 64px;
  background-position: 0 0;
  image-rendering: pixelated;
}

/* fuera escalones: todo es cuadrado */
:root[data-skin="bloques"] :is(.panel, .kid, .box > .panel, .rung, .alert, .next, .swatch, .switch, .kid .hero, .kidboard .hero, .stage, button, .btn, .chip, .day, .status, .pill, .tag, .role, .badge, .pindots span, .rung::before, .you::before, .life .track, #toast, .coin) {
  clip-path: none;
  border-radius: 0;
}

:root[data-skin="bloques"] .page-head h1 {
  text-shadow: 4px 4px 0 rgb(0 0 0 / 35%);
  color: var(--pk-on-strong);
}
:root[data-skin="bloques"] .page-head p {
  color: color-mix(in srgb, var(--pk-on-strong) 85%, transparent);
}
:root[data-skin="bloques"] h1,
:root[data-skin="bloques"] h2,
:root[data-skin="bloques"] h3 {
  font-weight: 700;
}

/* Paneles tipo inventario */
:root[data-skin="bloques"] .panel,
:root[data-skin="bloques"] .kid {
  background: var(--pk-surface);
  box-shadow: var(--bevel);
  padding: calc(var(--pk-space-5) + 6px);
}
:root[data-skin="bloques"] .kid {
  padding: 6px;
}

/* Héroe: bloque de tierra con pasto arriba */
:root[data-skin="bloques"] :is(.kid .hero, .kidboard .hero, .stage) {
  background-color: var(--pk-surface-strong);
  background-image:
    linear-gradient(to bottom, #5fae3a 0 10px, #3f7f25 10px 14px, transparent 14px),
    var(--dirt);
  background-size:
    100% 100%,
    64px 64px;
  box-shadow:
    inset 0 0 0 2px var(--blk-line),
    inset -4px -4px 0 2px var(--blk-lo);
  padding-top: calc(var(--pk-space-5) + 14px);
}
:root[data-theme="bloques-cueva"][data-skin="bloques"] :is(.kidboard .hero, .stage),
:root[data-skin="bloques"] .kid[data-theme="bloques-cueva"] .hero {
  background-image:
    linear-gradient(to bottom, #4a4a55 0 10px, #33333c 10px 14px, transparent 14px),
    var(--dirt);
}
:root[data-theme="bloques-desierto"][data-skin="bloques"] :is(.kidboard .hero, .stage),
:root[data-skin="bloques"] .kid[data-theme="bloques-desierto"] .hero {
  background-image:
    linear-gradient(to bottom, #e9d59c 0 10px, #c7ad6c 10px 14px, transparent 14px),
    var(--dirt);
}

:root[data-skin="bloques"] :is(.score .num, .giant) {
  text-shadow: 5px 5px 0 rgb(0 0 0 / 55%);
}
:root[data-skin="bloques"] .hero h2,
:root[data-skin="bloques"] .hello,
:root[data-skin="bloques"] .tagline {
  text-shadow: 3px 3px 0 rgb(0 0 0 / 45%);
}

/* Botones de piedra */
:root[data-skin="bloques"] :is(button, .btn) {
  background: #7d7d7d;
  color: #fff;
  text-shadow: 2px 2px 0 #3a3a3a;
  box-shadow: var(--bevel);
  padding-bottom: 0;
}
:root[data-skin="bloques"] :is(button, .btn)[type="submit"],
:root[data-skin="bloques"] .pinpad .go {
  background: var(--pk-accent);
  color: var(--pk-accent-ink);
}
:root[data-skin="bloques"] :is(button, .btn):not(.text, .danger):hover {
  filter: brightness(1.08);
  outline: 2px solid #fff;
  outline-offset: -2px;
}
:root[data-skin="bloques"] :is(button, .btn):active {
  transform: translateY(2px);
  box-shadow: var(--bevel-in);
}
:root[data-skin="bloques"] :is(button.ghost, .btn.ghost, .alert .btn) {
  background: var(--pk-surface);
  color: var(--pk-ink);
  text-shadow: none;
  box-shadow: var(--bevel);
}
:root[data-skin="bloques"] :is(button.text, button.danger) {
  background: none;
  box-shadow: none;
  text-shadow: none;
  outline: 0;
}
:root[data-skin="bloques"] button.text {
  color: inherit;
}
:root[data-skin="bloques"] button.danger {
  color: var(--pk-missed);
}

:root[data-skin="bloques"] .switch {
  background: #555;
  box-shadow: var(--bevel-in);
  padding: 6px;
}
:root[data-skin="bloques"] .switch button {
  background: transparent;
  box-shadow: none;
  color: #ddd;
}
:root[data-skin="bloques"] .switch button[aria-pressed="true"] {
  background: #7d7d7d;
  color: #fff;
  box-shadow: var(--bevel);
}

/* Campos hundidos, como casillas */
:root[data-skin="bloques"] :is(input, select) {
  border: 0;
  border-radius: 0;
  background: #8b8b8b;
  color: #fff;
  box-shadow: var(--bevel-in);
  text-shadow: 1px 1px 0 #3a3a3a;
}
:root[data-skin="bloques"] :is(input, select)::placeholder {
  color: #d8d8d8;
}
:root[data-skin="bloques"] select option {
  color: #111;
  background: #fff;
}
:root[data-skin="bloques"] .chip {
  border: 0;
  background: #8b8b8b;
  color: #fff;
  box-shadow: var(--bevel-in);
}
:root[data-skin="bloques"] .chip:has(input:checked) {
  background: var(--pk-accent);
  color: var(--pk-accent-ink);
  box-shadow: var(--bevel);
}
:root[data-skin="bloques"] .weight {
  border: 0;
  box-shadow: inset 0 0 0 2px var(--blk-line);
  gap: 0;
}
:root[data-skin="bloques"] :is(.weight button, .weight label) {
  background: #8b8b8b;
  color: #fff;
  box-shadow: var(--bevel-in);
}
:root[data-skin="bloques"] :is(.weight .on, .weight label:has(input:checked)) {
  background: var(--pk-accent);
  box-shadow: var(--bevel);
}

/* Barra de experiencia por bloques */
:root[data-skin="bloques"] .life .track {
  height: 24px;
  background: #1f1f1f;
  box-shadow: inset 0 0 0 2px var(--blk-line);
}
:root[data-skin="bloques"] .life .fill {
  inset: 4px;
  background:
    repeating-linear-gradient(to right, transparent 0 calc(10% - 3px), #1f1f1f calc(10% - 3px) 10%),
    linear-gradient(to bottom, #b6ff6a 0 30%, #6fdc2f 30% 70%, #3f9a1a 70%);
  box-shadow: none;
}
:root[data-skin="bloques"] .life[data-level="mid"] .fill {
  background:
    repeating-linear-gradient(to right, transparent 0 calc(10% - 3px), #1f1f1f calc(10% - 3px) 10%),
    linear-gradient(to bottom, #ffef8a 0 30%, #f2c53d 30% 70%, #b8860b 70%);
}
:root[data-skin="bloques"] .life[data-level="low"] .fill {
  background:
    repeating-linear-gradient(to right, transparent 0 calc(10% - 3px), #1f1f1f calc(10% - 3px) 10%),
    linear-gradient(to bottom, #ff9a7a 0 30%, #e0452b 30% 70%, #9a2412 70%);
}
:root[data-skin="bloques"] .life .fill::after {
  display: none;
}
:root[data-skin="bloques"] .life .notch::after {
  background: #fff;
  width: 4px;
}

/* Días como bloques */
:root[data-skin="bloques"] .day {
  box-shadow: var(--bevel);
  text-shadow: 1px 1px 0 rgb(0 0 0 / 35%);
}
:root[data-skin="bloques"] .day.today {
  outline: 3px solid #fff;
  outline-offset: 1px;
}

/* Tareas */
:root[data-skin="bloques"] .task + .task {
  border-top: 2px solid color-mix(in srgb, var(--pk-line) 70%, transparent);
}
:root[data-skin="bloques"] .task.pending {
  background: var(--pk-pending-soft);
  box-shadow: inset 0 0 0 2px var(--blk-line);
}
:root[data-skin="bloques"] .mark {
  background: #8b8b8b;
  color: #fff;
  box-shadow: var(--bevel-in);
}
:root[data-skin="bloques"] .mark.done.on {
  background: #2fae4a;
  box-shadow: var(--bevel);
}
:root[data-skin="bloques"] .mark.missed.on {
  background: #c4271c;
  box-shadow: var(--bevel);
}
:root[data-skin="bloques"] :is(.status, .pill, .tag, .role, .badge) {
  box-shadow: inset 0 0 0 2px var(--blk-line);
}

/* Premios */
:root[data-skin="bloques"] .rung {
  box-shadow: var(--bevel);
}
:root[data-skin="bloques"] .rung.reached {
  background: color-mix(in srgb, var(--pk-points) 45%, var(--pk-surface));
}
:root[data-skin="bloques"] .ladder::before {
  background: #6b4226;
  box-shadow: 0 0 0 2px var(--blk-line);
}
:root[data-skin="bloques"] .alert {
  box-shadow: var(--bevel);
}
:root[data-skin="bloques"] .next {
  box-shadow: inset 0 0 0 2px var(--blk-line);
}

/* PIN */
:root[data-skin="bloques"] .pinpad button {
  font-size: 1.6rem;
}
:root[data-skin="bloques"] .pindots span {
  box-shadow: var(--bevel-in);
}

:root[data-skin="bloques"] .swatch {
  background: var(--pk-surface);
  color: var(--pk-ink);
  box-shadow: var(--bevel);
  text-shadow: none;
}
:root[data-skin="bloques"] .swatch[aria-pressed="true"] {
  box-shadow:
    var(--bevel),
    inset 0 0 0 6px #fff;
}

:root[data-skin="bloques"] #toast {
  background: #2b2b2b;
  color: #fff;
  box-shadow: var(--bevel);
}

/* Barra de accesos tipo barra rápida */
:root[data-skin="bloques"] nav.tabs-nav {
  background: #2b2b2b;
  border-top: 4px solid var(--blk-line);
}
:root[data-skin="bloques"] nav.tabs-nav a {
  color: #cfcfcf;
}
:root[data-skin="bloques"] nav.tabs-nav a.active {
  color: #fff;
  box-shadow: inset 0 0 0 3px #fff;
  background: rgb(255 255 255 / 10%);
}
:root[data-skin="bloques"] nav.tabs-nav a.active::before {
  display: none;
}
@media (min-width: 1024px) {
  :root[data-skin="bloques"] nav.tabs-nav {
    background: #2b2b2b;
    border-right: 4px solid var(--blk-line);
    border-top: 0;
  }
}

/* Selector de estilo */
.styles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--pk-space-3);
  margin-bottom: var(--pk-space-5);
}
.style-opt {
  display: grid;
  justify-items: center;
  gap: var(--pk-space-2);
  padding: var(--pk-space-4) var(--pk-space-3);
  min-height: 44px;
}
.style-opt img {
  height: 32px;
  width: auto;
  image-rendering: pixelated;
}
.style-opt[aria-pressed="true"] {
  outline: 4px solid var(--pk-points);
  outline-offset: 2px;
}

/* bloques: legibilidad */
:root[data-skin="bloques"] :is(.task .name strong, .item strong, .rung .what, .next b) {
  font-family: "Pixelify Sans", "Nunito", system-ui, sans-serif;
  letter-spacing: 0;
}
:root[data-skin="bloques"] .score .num {
  font-size: clamp(2.75rem, 12vw, 3.75rem);
}
:root[data-skin="bloques"] .score.xl .num {
  font-size: clamp(3.75rem, 19vw, 7rem);
  letter-spacing: 0;
}
:root[data-skin="bloques"] .giant {
  font-size: clamp(5rem, 26vw, 9rem);
}
:root[data-skin="bloques"] .topbar .who {
  color: var(--pk-on-strong);
  text-shadow: 2px 2px 0 rgb(0 0 0 / 45%);
}
:root[data-skin="bloques"] .rung.locked {
  background: #8b8b8b;
  color: #f2f2f2;
  text-shadow: 1px 1px 0 #3a3a3a;
}
:root[data-skin="bloques"] .style-opt {
  padding-bottom: calc(var(--pk-space-4) + 4px);
}

/* Cerrar sesión siempre a mano en la barra superior */
.topbar-end {
  display: flex;
  align-items: center;
  gap: var(--pk-space-3);
  min-width: 0;
}
.topbar .style-toggle,
.topbar .logout {
  flex: none;
  min-height: var(--pk-tap-min);
  gap: 6px;
}
:root[data-skin="bloques"] .topbar .style-toggle,
:root[data-skin="bloques"] .topbar .logout {
  color: var(--pk-on-strong);
  text-shadow: 2px 2px 0 rgb(0 0 0 / 45%);
}
@media (max-width: 420px) {
  .topbar .style-toggle span,
  .topbar .logout span {
    display: none;
  }
}

/* Edición de tarea en línea */
.item.edit {
  display: grid;
  gap: var(--pk-space-4);
  align-items: stretch;
}

/* Dificultad legible */
.weight-wrap {
  display: inline-grid;
  margin-bottom: var(--pk-space-3);
}
.weight-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: var(--pk-text-label);
  color: var(--pk-ink-muted);
}
.weight-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

:root[data-skin="bloques"] .tag {
  background: #8b8b8b;
  color: #fff;
  text-shadow: 1px 1px 0 #3a3a3a;
}

/* Edición de premio y cambio de PIN */
.edit-card {
  position: relative;
  display: grid;
  gap: var(--pk-space-4);
  margin-left: 36px;
  padding: var(--pk-space-5);
  background: var(--pk-surface);
  border: 3px solid var(--wood-dark);
}
:root[data-skin="bloques"] .edit-card {
  border: 0;
  box-shadow: var(--bevel);
}
.chips.icons .chip {
  min-width: 48px;
  justify-content: center;
  font-size: 1.35rem;
}
.pin-edit {
  padding-top: var(--pk-space-3);
}
.rung:has(> button + button) {
  grid-template-columns: auto 1fr auto auto;
}

/* ---------- tareas extra ---------- */

.kind-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--pk-space-2);
}
.kind-opt {
  display: flex;
  gap: var(--pk-space-2);
  align-items: flex-start;
  min-height: var(--pk-tap-min);
  padding: var(--pk-space-2) var(--pk-space-3);
  border: 1px solid var(--pk-line);
  border-radius: var(--pk-radius-md);
  background: var(--pk-surface);
  cursor: pointer;
}
.kind-opt {
  position: relative;
}
/* El radio queda invisible sobre toda la tarjeta; el borde marca la elección. */
.kind-opt input {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.kind-opt:has(input:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--pk-accent) 45%, transparent);
  outline-offset: 2px;
}
.kind-opt:has(input:checked) {
  border-color: var(--pk-accent);
  box-shadow: inset 0 0 0 2px var(--pk-accent);
  background: color-mix(in srgb, var(--pk-accent) 10%, var(--pk-surface));
}
.kind-opt small {
  display: block;
  color: var(--pk-ink-muted);
  font-size: var(--pk-text-caption);
}
.list-head {
  margin: var(--pk-space-3) 0 var(--pk-space-2);
}
.list-head:first-child {
  margin-top: 0;
}
.tag.bonus-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tag.bonus-tag .i {
  width: 14px;
  height: 14px;
  color: var(--pk-points);
}
:root[data-skin="bloques"] .kind-opt {
  border-radius: 0;
  box-shadow: var(--bevel);
}
:root[data-skin="bloques"] .kind-opt:has(input:checked) {
  border-color: var(--pk-accent);
  box-shadow: var(--bevel-in);
}

/* extras en Hoy, detalle y tablero del hijo */
.bonus {
  margin-top: var(--pk-space-2);
  padding: var(--pk-space-3) var(--pk-space-3) var(--pk-space-2) var(--pk-space-4);
  border-top: 1px dashed var(--pk-line);
}
.panel .tasks .bonus {
  padding-left: 0;
  padding-right: 0;
}
.bonus h4 {
  margin: 0 0 var(--pk-space-2);
  font-size: var(--pk-text-label);
  color: var(--pk-ink-muted);
}
.bonus-list {
  list-style: none;
  margin: 0 0 var(--pk-space-2);
  padding: 0;
  display: grid;
  gap: var(--pk-space-1, 4px);
}
.bonus-line {
  display: flex;
  align-items: center;
  gap: var(--pk-space-2);
  min-height: var(--pk-tap-min);
}
.bonus .grow {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.bonus .ic {
  display: inline-flex;
  color: var(--pk-points);
}
.bonus .icon-btn {
  min-width: var(--pk-tap-min);
  min-height: var(--pk-tap-min);
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.bonus-picker {
  margin-top: var(--pk-space-2);
}
.bonus-picker button.wide {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--pk-space-2);
  min-height: var(--pk-tap-min);
}
.extra-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: var(--pk-space-1, 4px) 0 0;
  font-family: var(--pk-font-score);
  font-weight: 800;
  font-size: var(--pk-text-label);
  color: var(--pk-points);
}
.extra-badge .i {
  width: 16px;
  height: 16px;
}
.history .h .extra {
  display: block;
  font-size: var(--pk-text-caption);
  color: var(--pk-points);
  text-align: right;
}
.legend-extra .i {
  width: 12px;
  height: 12px;
  color: var(--pk-points);
}
.day[data-bonus="true"] {
  position: relative;
}
.day[data-bonus="true"]::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  background: var(--pk-points);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
button.day {
  border: 0;
  cursor: pointer;
  min-height: var(--pk-tap-min);
  color: inherit;
}
.day.selected {
  box-shadow: inset 0 0 0 3px var(--pk-points);
  transform: translateY(-2px);
}
:root:not([data-skin="bloques"]) :is(.bonus .ic, .extra-badge, .bonus-tag, .legend-extra) .i {
  shape-rendering: crispEdges;
}
:root[data-skin="bloques"] .day[data-bonus="true"]::after {
  clip-path: none;
}
.score.xl + .extra-badge {
  font-size: 1.125rem;
}
.score.xl + .extra-badge .i {
  width: 20px;
  height: 20px;
}
