/* Do Piano · shell para niños y padres.
   Botones: puerto fiel de "Tactile 3D Button" (21st.dev, bidyut10, id 34577) a CSS puro,
   con tamaños más grandes para dedos de niño y variantes con los colores de los stickers. */

:root {
  --bg: #fff8ec;
  --card: #ffffff;
  --ink: #2a2118;
  --ink-soft: #6b5d4c;
  --line: #efe3cf;
  --muted: #f3ece0;
  --gold: #f2b632;
  --gold-deep: #9a6a12;
  --go: #139337;
  --go-hover: #17a23e;
  --go-active: #0f7d2e;
  --do: #e8213f;
  --re: #f7941d;
  --mi: #f2e01d;
  --fa: #8cc63f;
  --sol: #19b5c8;
  --la: #4b2a8c;
  --si: #d12a8f;
  --stage: #1e1810;
  --display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --ui: 'Nunito', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);

  /* sombras del componente original, sin cambios */
  --bevel-light: 0 1px 1px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.1), 0 6px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 2px rgba(255, 255, 255, 0.35), inset 0 -2px 4px rgba(0, 0, 0, 0.08);
  --pressed-light: 0 1px 1px rgba(0, 0, 0, 0.05), inset 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 2px 4px rgba(0, 0, 0, 0.04),
    inset 0 -1px 2px rgba(0, 0, 0, 0.05);
  --bevel-dark: 0 1px 1px rgba(0, 0, 0, 0.35), 0 3px 6px rgba(0, 0, 0, 0.28), 0 8px 16px rgba(0, 0, 0, 0.22),
    inset 0 1px 2px rgba(255, 255, 255, 0.14), inset 0 -3px 6px rgba(0, 0, 0, 0.55);
  --pressed-dark: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 2px 6px rgba(0, 0, 0, 0.55), inset 0 -1px 1px rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { font-family: var(--display); line-height: 1.1; margin: 0; }

svg { width: 1.25em; height: 1.25em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.shell {
  max-width: 980px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

[hidden] { display: none !important; }
.btn3d.is-locked { opacity: 0.55; filter: grayscale(0.6); }

.card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 12px 32px -18px rgba(42, 33, 24, 0.25);
}

/* ---------------------------------------------------------------- botón 3D */

.btn3d {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  cursor: pointer;
  font-family: var(--ui);
  font-weight: 800;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 200ms var(--ease), box-shadow 200ms var(--ease), color 200ms var(--ease), transform 200ms var(--ease);
  touch-action: manipulation;
}

.btn3d:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn3d:disabled { pointer-events: none; cursor: not-allowed; opacity: 0.4; }

@media (prefers-reduced-motion: reduce) { .btn3d { transition: none; } }

/* variantes del original */
.btn3d-solid { background: #262626; color: #fff; box-shadow: var(--bevel-dark); }
@media (hover: hover) { .btn3d-solid:hover { background: #404040; } }
.btn3d-solid:active { background: #171717; box-shadow: var(--pressed-dark); }

.btn3d-soft { background: #fafafa; color: #262626; box-shadow: var(--bevel-light); }
@media (hover: hover) { .btn3d-soft:hover { color: #171717; } }
.btn3d-soft:active { background: #f5f5f5; box-shadow: var(--pressed-light); }

.btn3d-muted { background: #f5f5f5; color: #404040; box-shadow: var(--bevel-light); }
@media (hover: hover) { .btn3d-muted:hover { background: #ececec; color: #171717; } }
.btn3d-muted:active { background: #e5e5e5; box-shadow: var(--pressed-light); }

/* variante "go": el bisel oscuro del original sobre el verde de Si */
.btn3d-go { background: var(--go); color: #fff; box-shadow: var(--bevel-dark); }
@media (hover: hover) { .btn3d-go:hover { background: var(--go-hover); } }
.btn3d-go:active { background: var(--go-active); box-shadow: var(--pressed-dark); }

/* estado "pulsado y se queda" para los interruptores */
.btn3d-soft[aria-pressed='true'] { background: #dff2e4; box-shadow: var(--pressed-light); color: #0d5a22; }
.btn3d-soft[aria-pressed='true'] svg { color: var(--go); }

/* tamaños del original + tamaños para niños */
.btn3d-sm { height: 2.5rem; padding: 0 0.9rem; border-radius: 0.75rem; font-size: 0.95rem; }
.btn3d-md { height: 3.25rem; padding: 0 1.1rem; border-radius: 0.9rem; font-size: 1rem; }
.btn3d-lg { height: 3.75rem; padding: 0 1.4rem; border-radius: 1rem; font-size: 1.1rem; }
.btn3d-xl { height: 5.25rem; padding: 0 2.4rem; border-radius: 1.6rem; font-size: 1.6rem; font-family: var(--display); }
.btn3d-xl svg { width: 1.4em; height: 1.4em; }
.btn3d-icon { width: 3.25rem; height: 3.25rem; padding: 0; border-radius: 0.9rem; flex: 0 0 auto; }
.btn3d-icon svg { width: 1.5rem; height: 1.5rem; }
.btn3d-lgicon { width: 4.25rem; height: 4.25rem; border-radius: 1.3rem; }
.btn3d-lgicon svg { width: 1.9rem; height: 1.9rem; }

/* ---------------------------------------------------------------- bienvenida */

.onboard {
  max-width: 560px;
  margin: 4vh auto 0;
  padding: 26px;
  background: var(--card);
  border-radius: 28px;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 24px 48px -24px rgba(42, 33, 24, 0.3);
}

.onboard-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.onboard-bar {
  height: 10px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--muted);
  overflow: hidden;
}

.onboard-fill {
  height: 100%;
  width: 25%;
  border-radius: 999px;
  background: var(--go);
  transition: width 300ms var(--ease);
}

.onboard-viewport { overflow: hidden; }

.onboard-track {
  display: flex;
  transition: transform 350ms var(--ease);
}

.onboard-slide {
  flex: 0 0 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 18px 26px; /* deja aire para que la sombra del botón no asome en la otra diapositiva */
  text-align: center;
}

.onboard-slide h1 { font-size: clamp(1.7rem, 5vw, 2.2rem); }
.onboard-slide p { margin: 0; max-width: 34ch; color: var(--ink-soft); font-size: 1.1rem; }

.onboard-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #e8f5ec;
  color: var(--go);
}

.onboard-icon svg { width: 44px; height: 44px; }

.onboard-actions { display: flex; gap: 12px; }
.onboard-actions .btn3d { flex: 1; }

.choice { display: grid; gap: 12px; width: 100%; margin-top: 6px; }

.btn3d-choice {
  height: auto;
  min-height: 4.5rem;
  padding: 14px 20px;
  justify-content: flex-start;
  border-radius: 1.2rem;
  font-size: 1.2rem;
  text-align: left;
}

.btn3d-choice svg { width: 2rem; height: 2rem; color: var(--go); }

/* la tira de colores: 7 teclas blancas con sus negras de referencia (2 y 3), y la tira que se pone y se quita */
.strip-demo { padding: 10px; border-radius: 16px; background: var(--stage); }

.strip-keys { position: relative; display: flex; gap: 4px; }

.strip-keys > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 40px;
  height: 108px;
  padding-bottom: 8px;
  border-radius: 0 0 8px 8px;
  background: #fbf7ef;
  font-size: 0.72rem;
  font-weight: 800;
}

.strip-keys b { display: block; color: var(--ink); }

.strip-keys i {
  position: relative;
  z-index: 2;
  display: block;
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
  border-radius: 50%;
  opacity: 0;
  transform: translateY(-26px) scale(0.6);
  transition: opacity 220ms var(--ease), transform 320ms var(--ease);
}

.strip-keys i.is-on { opacity: 1; transform: none; }

/* la tira misma: crece de izquierda a derecha según cuántas notas ya están puestas */
.strip-band {
  position: absolute;
  z-index: 1;
  left: 2px;
  bottom: 24px;
  height: 32px;
  width: calc((100% - 4px) * var(--n, 0) / 7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 0 rgba(42, 33, 24, 0.18), inset 0 0 0 1px rgba(42, 33, 24, 0.1);
  transition: width 320ms var(--ease);
}

.strip-keys u {
  position: absolute;
  z-index: 3;
  top: 0;
  left: calc(var(--at) * (100% + 4px) / 7 - 2px);
  width: 24px;
  height: 58px;
  border-radius: 0 0 5px 5px;
  background: var(--stage);
  transform: translateX(-50%);
  transition: box-shadow 260ms var(--ease), background 260ms var(--ease);
}

.strip-demo.is-landmark .strip-keys u.is-two { background: #4a3d2e; box-shadow: 0 0 0 3px var(--gold); }

.strip-demo .strip-keys i, .strip-demo .strip-band { will-change: transform, opacity; }
.strip-demo.is-lift .strip-keys i, .strip-demo.is-lift .strip-band {
  opacity: 0;
  transform: translateY(-30px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}

.strip-say { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; margin: -4px 0 -6px; }
.pat-strip { position: relative; width: 52px; height: 52px; flex: 0 0 auto; }
.strip-cap { font-weight: 800; color: var(--ink); font-size: 1rem; }

.big-input {
  width: 100%;
  height: 4rem;
  padding: 0 18px;
  border: 3px solid var(--line);
  border-radius: 1.1rem;
  background: #fff;
  font: inherit;
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
}

.big-input:focus { outline: none; border-color: var(--go); }

/* ---------------------------------------------------------------- mapa */

.map-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 18px;
}

.hello { font-size: clamp(2rem, 7vw, 3rem); }
.hello-sub { margin: 4px 0 0; font-size: 1.15rem; color: var(--ink-soft); font-weight: 700; }

.map-top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* contadores del mapa: racha, Notas y estrellas. Información, no botones. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 2.5rem;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.chip svg { width: 1.15rem; height: 1.15rem; stroke-width: 2.4; }
.chip-fire { background: #fff0e2; color: #a8440a; }
.chip-fire svg { color: #e2641a; }
.chip-notas { background: #e7f6ec; color: #0d5a22; }
.chip-notas svg { color: var(--go); }
.chip-stars { background: #fff4d6; color: var(--gold-deep); }
.chip-stars svg { color: var(--gold); stroke: var(--gold-deep); stroke-width: 1.2; fill: currentColor; }

.levels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; } /* minmax: en un teléfono de 320px el mapa se salía 20px de lado */

.level {
  --level: var(--do);
  padding: 18px 16px 26px;
  background: var(--card);
  border-radius: 28px;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 12px 32px -18px rgba(42, 33, 24, 0.25);
}

.level[data-level='2'] { --level: var(--la); }
.level[data-level='3'] { --level: var(--sol); }
.level[data-level='4'] { --level: var(--si); }

.level-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--level);
  color: #fff;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
}

.level-banner .tag { font-size: 0.85rem; font-weight: 800; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.06em; }
.level-banner h2 { font-size: 1.5rem; }
.level-banner .count { margin-left: auto; font-family: var(--display); font-size: 1.2rem; white-space: nowrap; }
.level-banner svg { width: 1.8rem; height: 1.8rem; }

.level.is-locked .level-banner { background: #cfc6b8; }
/* el título se encoge y el conteo queda dentro de la tarjeta en 320px (revisión 100x r3) */
.level-banner > div { min-width: 0; flex: 1 1 auto; }
.level-banner h2 { overflow-wrap: normal; hyphens: auto; }
@media (max-width: 360px) { .level-banner h2 { font-size: 1.25rem; } } /* sin cortar palabras a la mitad (revisión 100x r4) */
#btn-parents { height: 2.75rem; } /* 44px: el mínimo para un dedo */
.hand-label { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.hand-label svg { width: 1.3rem; height: 1.3rem; }
.hand-label.is-left svg { transform: scaleX(-1); }
.hand-section { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 10px 16px; border-radius: 16px; background: #fde7c2; color: #7a4a05; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08); }
.hand-section.is-left { background: #e6dcf7; color: var(--la); }
.hand-section svg { width: 1.6rem; height: 1.6rem; }
.hand-section.is-left svg { transform: scaleX(-1); }
.hand-section .tag { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; }
.hand-section h3 { font-size: 1.2rem; line-height: 1.1; }
.hand-section .count { margin-left: auto; font-family: var(--display); font-size: 1.1rem; white-space: nowrap; }
.hand-note { margin-top: 22px; padding: 12px 16px; border-radius: 16px; background: #f3ecfb; border: 2px solid #d9cbf0; color: var(--ink); font-size: 0.95rem; }
.hand-note p { margin: 0; }
.hand-note-videos:empty { display: none; }

.path {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}

.node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 170px;
  text-align: center;
}

.node:nth-child(4n + 2) { transform: translateX(72px); }
.node:nth-child(4n + 4) { transform: translateX(-72px); }

.node-btn {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 2.2rem;
}

.node-btn svg { width: 2.2rem; height: 2.2rem; }

.node-btn.is-current { background: var(--level); color: #fff; box-shadow: var(--bevel-dark); }
.node-btn.is-current:hover { filter: brightness(1.06); }
.node-btn.is-current:active { box-shadow: var(--pressed-dark); }
.node-btn.is-current::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 4px solid var(--level);
  opacity: 0.45;
  animation: ring 1.6s var(--ease) infinite;
}

.node-btn.is-done { background: var(--gold); color: #fff; box-shadow: var(--bevel-dark); }
.node-btn.is-done:active { box-shadow: var(--pressed-dark); }
.node-btn.is-done svg { color: #fff; }

.node-btn.is-locked { color: #a89d8c; }

@keyframes ring {
  0% { transform: scale(0.9); opacity: 0.55; }
  100% { transform: scale(1.18); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) { .node-btn.is-current::after { animation: none; } }

.node-title { font-weight: 800; font-size: 1rem; line-height: 1.2; }
.node-stars { display: flex; gap: 2px; color: #e6dccb; }
.node-stars svg { width: 1.1rem; height: 1.1rem; stroke-width: 1.2; }
.node-stars .on { color: var(--gold); stroke: var(--gold-deep); }

.level-soon { margin: 16px 0 0; text-align: center; font-weight: 700; color: var(--ink-soft); }

.cert-slot { margin-top: 22px; }

.cert-slot-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  background: #fff4d6;
}

.cert-slot-card .trophy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  flex: 0 0 auto;
}

.cert-slot-card .trophy svg { width: 34px; height: 34px; }
.cert-slot-card p { margin: 0; font-weight: 800; font-size: 1.1rem; }
.cert-slot-card .btn3d { margin-left: auto; }

/* ---------------------------------------------------------------- lección */

.lesson-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 14px;
}

.lesson-titles { min-width: 0; }
/* la casita de Casa Piano junto al título (antes iba dentro del escenario, sobre las notas) */
.lesson-brand {
  flex: 0 0 auto;
  width: 2rem;
  aspect-ratio: 400 / 541;
  background: var(--ink);
  -webkit-mask: url('../assets/brand/logo-cream.webp') center / contain no-repeat;
  mask: url('../assets/brand/logo-cream.webp') center / contain no-repeat;
  opacity: 0.85;
}
.lesson-kicker { font-size: 0.9rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }
.lesson-titles h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); }


.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 62vh;
  background: var(--stage);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 22px 48px -28px rgba(30, 24, 16, 0.6);
}

.stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

body.tablet-mode .stage { box-shadow: 0 0 0 4px var(--go), 0 22px 48px -28px rgba(30, 24, 16, 0.6); }
body.tablet-mode .stage canvas { cursor: pointer; }

.hint {
  min-height: 1.6em;
  margin: 14px 0 6px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
}

.console {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 8px 0 18px;
}

.toggles {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.seg {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 1.2rem;
  background: var(--muted);
}

/* ---------------------------------------------------------------- cuaderno */

.sheet { padding: 22px; }

.sheet-sub { margin: 0 0 14px; font-weight: 700; color: var(--ink-soft); }

.parent-notes {
  margin-top: 18px;
  border-radius: 18px;
  background: #fff4d6;
}

.parent-notes summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 3.25rem;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  color: var(--gold-deep);
  list-style: none;
}

.parent-notes summary::-webkit-details-marker { display: none; }

.sheet-guide {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
  padding: 0 18px 18px;
  font-size: 1rem;
}

.sheet-guide dt { font-weight: 800; color: var(--gold-deep); }
.sheet-guide dd { margin: 0; }

.sheet-bars { position: relative; display: grid; gap: 10px; }

.bar { display: flex; align-items: stretch; gap: 10px; }
.bar-stack { flex: 1; display: grid; gap: 3px; }


.bar-notes { display: flex; align-items: stretch; gap: 4px; min-height: 44px; }
.bar-notes.is-left { min-height: 34px; }

.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 6px 4px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 800;
  overflow: hidden;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

.bar-notes.is-left .pill { font-size: 0.85rem; border-radius: 10px; }

.pill { gap: 6px; }

.pill-finger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 0.85em;
  font-weight: 800;
}

.rest {
  display: block;
  border-radius: 12px;
  background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(107, 93, 76, 0.12) 6px 9px);
}


/* ---------------------------------------------------------------- barra de abajo */

body.has-tabbar .shell { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: min(440px, calc(100% - 24px));
  padding: 6px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.08), 0 14px 34px -14px rgba(42, 33, 24, 0.35);
}

.tab {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 58px;
  padding: 6px 4px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 180ms var(--ease), color 180ms var(--ease), transform 150ms var(--ease);
}
.tab svg { width: 1.6rem; height: 1.6rem; }
.tab:active { transform: scale(0.95); }
.tab:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.tab[aria-current='page'] { background: #e7f6ec; color: #0d5a22; }
.tab[aria-current='page'] svg { color: var(--go); }
.tab[data-tab='closet']:not([aria-current='page']) svg { color: var(--gold-deep); }
.tab-icon { position: relative; display: grid; }
.tab-dot {
  position: absolute;
  top: -2px;
  right: -6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--do);
  box-shadow: 0 0 0 2px #fff;
}

/* ---------------------------------------------------------------- closet de Patitas */

.closet-wallet { margin-left: auto; font-size: 1.05rem; }

.closet { display: grid; gap: 16px; }

.closet-stage {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  background: var(--card);
  border-radius: 26px;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 12px 32px -18px rgba(42, 33, 24, 0.25);
  overflow: hidden;
  isolation: isolate;
}

/* Patitas sobre su alfombra: el suelo es una elipse, la luz un círculo cálido */
.closet-stage::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 12px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 55%, #fff4d6 0%, #fff8ec 55%, rgba(255, 248, 236, 0) 72%);
  z-index: -2;
}

.pat-closet { width: 170px; height: 170px; margin: 34px 10px 6px; }
.pat-closet::after {
  content: '';
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 2%;
  height: 12%;
  border-radius: 50%;
  background: rgba(42, 33, 24, 0.1);
  z-index: -1;
}

.closet-info { position: relative; display: grid; gap: 6px; justify-items: start; min-width: 0; flex: 1; }
.closet-name { margin: 0; font-family: var(--display); font-size: 1.7rem; line-height: 1.05; color: var(--ink); }
.closet-note { margin: 0 0 6px; font-weight: 700; font-size: 0.95rem; color: var(--ink-soft); }
.closet-action { min-width: 12rem; }
.closet-action svg { width: 1.2em; height: 1.2em; }
.closet-action.is-confirm { background: var(--gold); color: var(--ink); }
.closet-action.is-confirm:active { background: #e3a722; }

.closet-tier {
  display: inline-flex;
  align-items: center;
  height: 1.6rem;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--tier-bg, var(--muted));
  color: var(--tier-ink, var(--ink-soft));
}

[data-tier='gratis'] { --tier: var(--fa); --tier-bg: #eef7e0; --tier-ink: #3f6b12; }
[data-tier='diario'] { --tier: var(--sol); --tier-bg: #e1f6f8; --tier-ink: #0c6873; }
[data-tier='especial'] { --tier: var(--re); --tier-bg: #fff0e2; --tier-ink: #a8440a; }
[data-tier='premium'] { --tier: var(--la); --tier-bg: #ece6f7; --tier-ink: var(--la); }
[data-tier='look'] { --tier-bg: #fde7ef; --tier-ink: #a3165f; }
[data-tier='legendario'] { --tier: var(--gold); --tier-bg: #fff4d6; --tier-ink: var(--gold-deep); }

.closet-tabs { justify-self: stretch; display: flex; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.closet-tabs::-webkit-scrollbar { display: none; }
.closet-tabs .btn3d { flex: 1 0 auto; }
.closet-tabs .btn3d { padding: 0 0.4rem; }

.closet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }

.closet-item {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 8px 12px;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--bevel-light);
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  transition: transform 150ms var(--ease), box-shadow 200ms var(--ease);
}
.closet-item::before { content: ''; position: absolute; inset: 0 0 auto; height: 5px; background: var(--tier, var(--line)); }
.closet-item:active { transform: scale(0.97); box-shadow: var(--pressed-light); }
.closet-item:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.closet-item[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--gold), var(--bevel-light); background: #fffaf0; }

.closet-item .pat { width: 78px; height: 78px; margin-top: 20px; }
.closet-item.is-locked .pat { filter: grayscale(1) opacity(0.55); }
.closet-item b { font-size: 0.88rem; line-height: 1.15; text-align: center; }
.closet-item small { font-size: 0.72rem; font-weight: 700; color: var(--ink-soft); line-height: 1.2; text-align: center; }
.closet-item[data-tier='look'] { --tier: linear-gradient(90deg, var(--do), var(--re), var(--mi), var(--fa), var(--sol), var(--la)); }
.closet-item[data-tier='look']::before { background: var(--tier); }

.closet-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 1.5rem;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--muted);
  color: var(--ink-soft);
}
.closet-tag svg { width: 0.95rem; height: 0.95rem; }
.closet-tag.is-price { background: #e7f6ec; color: #0d5a22; }
.closet-tag.is-short { background: var(--muted); color: var(--ink-soft); }
.closet-tag.is-mine { background: #eef7e0; color: #3f6b12; }
.closet-tag.is-on { background: var(--go); color: #fff; }
.closet-tag.is-lock { background: #ece6f7; color: var(--la); }
.closet-tag.is-pack { background: linear-gradient(90deg, #fde7ef, #fff4d6); color: #a3165f; }
[data-tier='pack'] { --tier: linear-gradient(90deg, var(--si), var(--gold)); --tier-bg: linear-gradient(90deg, #fde7ef, #fff4d6); --tier-ink: #a3165f; }
.closet-item[data-tier='pack']::before { background: var(--tier); }
.closet-tier[data-tier='pack'] { background: var(--tier-bg); }

.closet-pop { animation: pat-pop 0.6s var(--ease); }

@media (max-width: 560px) {
  .closet-stage { flex-direction: column; text-align: center; padding: 10px 16px 18px; }
  .closet-stage::before { left: 50%; transform: translateX(-50%); }
  .closet-info { justify-items: center; }
  .pat-closet { width: 150px; height: 150px; margin: 40px 0 0; }
  .closet-name { font-size: 1.5rem; }
  .closet-action { width: 100%; }
  .closet-tabs { gap: 8px; padding: 6px; }
  .closet-tabs .btn3d { font-size: 0.82rem; }
  .closet-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .closet-item .pat { width: 64px; height: 64px; margin-top: 16px; }
  .closet-wallet { font-size: 0.95rem; }
}

/* ---------------------------------------------------------------- padres */

.parents { display: grid; gap: 16px; }

.parent-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.stat {
  padding: 16px;
  border-radius: 20px;
  background: var(--card);
  text-align: center;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 12px 32px -18px rgba(42, 33, 24, 0.25);
}

.stat b { display: block; font-family: var(--display); font-size: 2.2rem; line-height: 1; }
.stat span { font-weight: 700; color: var(--ink-soft); font-size: 0.95rem; }

.parent-card { padding: 20px; }
.parent-card h2 { font-size: 1.5rem; margin-bottom: 10px; }

.steps { margin: 0; padding-left: 1.4em; display: grid; gap: 8px; }

.parent-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.calendar-title { font-family: var(--display); font-size: 1.3rem; text-transform: capitalize; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }

.weekday { text-align: center; font-size: 0.85rem; font-weight: 800; color: var(--ink-soft); }
.blank { visibility: hidden; }

.day {
  height: 3rem;
  border: 0;
  border-radius: 0.8rem;
  background: #fafafa;
  box-shadow: var(--bevel-light);
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.day:active { box-shadow: var(--pressed-light); }
.day:disabled { opacity: 0.3; cursor: default; box-shadow: none; }
.day.is-today { outline: 3px solid var(--gold); outline-offset: -3px; }
.day.is-practiced { background: var(--go); color: #fff; box-shadow: var(--bevel-dark); }
.day:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------------------------------------------------------------- acceso */

.gate { max-width: 560px; margin: 6vh auto 0; padding: 28px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.gate h1 { font-size: 2rem; }
.gate-copy, .gate-note { margin: 0; color: var(--ink-soft); }
.gate-form { display: grid; gap: 12px; width: 100%; }
.gate-form label { font-weight: 800; }
.gate-form .big-input { font-size: 1rem; }
.gate-feedback { margin: 0; min-height: 1.4em; font-weight: 700; }
.gate-alt a { font-weight: 800; color: var(--go); }

/* ---------------------------------------------------------------- certificado */

.cert-locked { max-width: 560px; margin: 0 auto; padding: 26px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.cert-count { margin: 0; font-family: var(--display); font-size: 3rem; line-height: 1; }
.cert-locked p { margin: 0; color: var(--ink-soft); font-weight: 700; }

.cert-card {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 44px 28px;
  border: 3px solid var(--gold);
  border-radius: 24px;
  background: #fffdf7;
  text-align: center;
}

.cert-card::after { content: ''; position: absolute; inset: 10px; border: 1px solid rgba(242, 182, 50, 0.6); border-radius: 16px; pointer-events: none; }
.cert-brand { display: block; letter-spacing: 0.14em; font-size: 0.85rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; }
.cert-kicker { display: block; margin-top: 8px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-deep); }
.cert-heading { margin: 10px 0 18px; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.cert-name { margin: 0 0 16px; font-family: var(--display); font-size: clamp(2.2rem, 7vw, 3.4rem); color: var(--gold-deep); }
.cert-copy { margin: 0 0 14px; }
.cert-date { margin: 0 0 20px; color: var(--ink-soft); }
.cert-sign { margin: 0; font-weight: 800; }
.cert-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

.credits { margin: 28px 0 0; text-align: center; font-size: 0.75rem; color: var(--ink-soft); opacity: 0.7; }

/* ---------------------------------------------------------------- teléfono */

@media (max-width: 620px) {
  body { font-size: 16px; }
  .lesson-top { gap: 10px; }
  .lesson-kicker { font-size: 0.72rem; }
  .lesson-titles h1 { font-size: 1.45rem; }
  .console { gap: 12px; }
  .node:nth-child(4n + 2) { transform: translateX(48px); }
  .node:nth-child(4n + 4) { transform: translateX(-48px); }
  .btn3d-xl { height: 4.5rem; padding: 0 1.6rem; font-size: 1.35rem; }
  .btn3d-lgicon { width: 3.75rem; height: 3.75rem; }
  .seg .btn3d-md { padding: 0 0.8rem; font-size: 0.92rem; }
  .sheet-guide { grid-template-columns: 1fr; }
  .sheet-guide dd { margin-bottom: 6px; }
  .parent-stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat { padding: 12px 6px; }
  .stat b { font-size: 1.7rem; }
  .cert-slot-card { flex-wrap: wrap; }
  .cert-slot-card .btn3d { margin-left: 0; width: 100%; }
  .onboard { padding: 20px 16px; margin-top: 1vh; }
  .strip-keys > span { width: 34px; }
}

/* con la mano visible el escenario crece hacia abajo para que quepa la palma */

.hand3d-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------------------------------------------------------------- canción a pantalla completa
   La lección ocupa justo el alto visible (dvh descuenta las barras de Safari): el piano crece o
   encoge y los botones siempre quedan a la vista, en teléfono y en iPad, de pie o acostado. */

#view-leccion:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - max(16px, env(safe-area-inset-top)) - 24px - env(safe-area-inset-bottom));
  min-height: 460px;
}

#view-leccion .stage {
  flex: 1 1 auto;
  min-height: calc(200px + var(--island-h, 78px)); /* 200 para notas y piano, más la franja de Patitas: si no, el lienzo se aplastaba (revisión 100x r3) */
  aspect-ratio: auto;
  max-height: none;
}

#view-leccion .lesson-top,
#view-leccion .hint,
#view-leccion .console,
#view-leccion .toggles { flex: 0 0 auto; }

#view-leccion .lesson-titles h1 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* teléfono de pie: todo más compacto, interruptores en una fila con el ícono arriba */
@media (max-width: 620px) {
  #view-leccion .lesson-top { margin: 0 0 10px; }
  #view-leccion .lesson-titles h1 { font-size: 1.3rem; }
  #view-leccion .hint { font-size: 1rem; margin: 10px 0 4px; min-height: 2.6em; }
  #view-leccion .console { margin: 4px 0 10px; }
  #view-leccion .toggles { gap: 8px; flex-wrap: nowrap; }
  #view-leccion .seg { gap: 8px; padding: 5px; flex: 1; }
  #view-leccion .seg .btn3d-md {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    height: 3.05rem;
    padding: 0 4px;
    font-size: 0.78rem;
    line-height: 1.1;
  }
  #view-leccion .seg .btn3d-md svg { width: 1.3rem; height: 1.3rem; }
}

/* consejo para girar el teléfono: solo teléfonos de pie, hasta que lo cierran */
.rotate-tip { display: none; }
@media (max-width: 620px) and (orientation: portrait) and (pointer: coarse) {
  body:not(.rotate-tip-off) #view-leccion .rotate-tip {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    padding: 8px 10px 8px 12px;
    border-radius: 14px;
    background: #fff4d6;
    color: var(--gold-deep);
    font-weight: 800;
    font-size: 0.9rem;
    line-height: 1.2;
  }
  .rotate-tip svg { width: 1.8rem; height: 1.8rem; flex: 0 0 auto; animation: tip-turn 2.4s var(--ease) infinite; }
  .rotate-tip span { flex: 1; }
}
@keyframes tip-turn { 0%, 30% { transform: rotate(0); } 55%, 100% { transform: rotate(90deg); } }
@media (prefers-reduced-motion: reduce) { .rotate-tip svg { animation: none; } }

/* teléfono acostado: el piano usa todo el alto a la izquierda; título, botones e interruptores
   en una columna a la derecha */
@media (orientation: landscape) and (max-height: 520px) {
  .shell { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  #view-leccion:not([hidden]) {
    display: grid;
    grid-template-columns: 1fr minmax(190px, 230px);
    grid-template-rows: auto auto 1fr auto;
    column-gap: 14px;
    row-gap: 8px;
    height: calc(100dvh - max(10px, env(safe-area-inset-top)) - max(10px, env(safe-area-inset-bottom)));
    min-height: 0;
  }
  #view-leccion .stage { grid-column: 1; grid-row: 1 / -1; min-height: 0; height: 100%; }
  #view-leccion .lesson-top { grid-column: 2; grid-row: 1; margin: 0; gap: 8px; }
  #view-leccion .lesson-top .btn3d-icon { width: 2.6rem; height: 2.6rem; }
  #view-leccion .lesson-titles h1 { font-size: 1.05rem; -webkit-line-clamp: 2; }
  /* el botón verde más bajito: la columna se pasaba del alto y el teclado quedaba cortado abajo (revisión 100x r3) */
  #view-leccion .console .btn3d-xl { height: 3.6rem; font-size: 1.3rem; padding: 0 1.4rem; }
  #view-leccion .toggles { min-height: 0; overflow-y: auto; overscroll-behavior: contain; } /* si no cabe, se desliza ella; el piano no se corta */
  #view-leccion .lesson-kicker { font-size: 0.66rem; }
  #view-leccion .console { grid-column: 2; grid-row: 2; flex-wrap: wrap; margin: 0; gap: 8px; justify-content: space-between; }
  #view-leccion .console .btn3d-xl { order: -1; width: 100%; height: 3.4rem; font-size: 1.2rem; }
  #view-leccion .console .btn3d-lgicon { width: calc(50% - 4px); height: 2.8rem; border-radius: 0.9rem; }
  #view-leccion .toggles { grid-column: 2; grid-row: 3; align-self: start; flex-direction: column; gap: 6px; }
  #view-leccion .seg { width: 100%; }
  #view-leccion .seg .btn3d-md { flex: 1; height: 2.5rem; font-size: 0.76rem; padding: 0 6px; gap: 4px; }
  #view-leccion .hint { grid-column: 2; grid-row: 4; font-size: 0.8rem; margin: 0; min-height: 0; text-align: left; }
}


/* ---------------------------------------------------------------- video de la maestra
   Puerto de "Thumbnail button video player" (21st.dev, arunachalam): botón con miniatura + ícono de
   play, y un cuadro que crece desde el botón (0.4 s, ease 0.25 0.46 0.45 0.94). */

.teacher-btn {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  margin: 10px auto 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--muted);
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.08);
  cursor: pointer;
  font: inherit;
  transition: box-shadow 200ms var(--ease), transform 150ms var(--ease);
}
.teacher-btn[hidden] { display: none; }
.teacher-btn:active { transform: scale(0.95); }
@media (hover: hover) { .teacher-btn:hover { box-shadow: 0 4px 12px rgba(42, 33, 24, 0.14); } }
.teacher-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.teacher-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 84px;
  height: 52px;
  border-radius: 0.6rem;
  overflow: hidden;
  background: var(--stage);
}
.teacher-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.teacher-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.teacher-play svg {
  width: 26px;
  height: 26px;
  padding: 6px 5px 6px 7px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.teacher-text { padding: 0 10px 0 12px; font-weight: 800; font-size: 1.05rem; color: var(--ink); }

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(255, 248, 236, 0.8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.video-modal[hidden] { display: none; }
.video-modal.is-open { opacity: 1; }

.video-box {
  position: relative;
  width: 100%;
  max-width: 56rem;
  max-height: calc(100dvh - 32px);
  aspect-ratio: 16 / 9;
  border-radius: 1.5rem;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px -20px rgba(42, 33, 24, 0.5);
  transform: scale(0.1);
  opacity: 0;
  transition: transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
/* video vertical: que quepa a lo alto */
.video-box { width: min(100%, calc((100dvh - 32px) * var(--ar, 1.7778))); }
.video-modal.is-open .video-box { transform: scale(1); opacity: 1; }
.video-box video { width: 100%; height: 100%; display: block; background: #000; }

.video-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  cursor: pointer;
}
.video-close svg { width: 24px; height: 24px; }
@media (hover: hover) { .video-close:hover { background: rgba(0, 0, 0, 0.6); } }

@media (prefers-reduced-motion: reduce) { .video-box, .video-modal { transition: none; } }

@media (orientation: landscape) and (max-height: 520px) {
  #view-leccion .teacher-btn { grid-column: 2; grid-row: 4; margin: 0; align-self: end; justify-self: stretch; }
  #view-leccion .teacher-thumb { width: 64px; height: 40px; }
  #view-leccion .teacher-text { font-size: 0.85rem; }
}

/* ---------------------------------------------------------------- micrófono
   El botón muestra el volumen que oye (barra verde que sube) para que el niño vea que lo escucha. */
.mic-btn { position: relative; overflow: hidden; }
.mic-btn::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--lvl, 0) * 100%);
  background: rgba(19, 147, 55, 0.22);
  transition: height 80ms linear;
  pointer-events: none;
}
body.mic-mode .stage { box-shadow: 0 0 0 4px var(--sol), 0 22px 48px -28px rgba(30, 24, 16, 0.6); }

@media (max-width: 620px) { #view-leccion .toggles { flex-wrap: wrap; } }

/* teléfono acostado con tres modos: ícono arriba y texto abajo para que quepan */
@media (orientation: landscape) and (max-height: 520px) {
  #view-leccion .seg .btn3d-md { flex-direction: column; gap: 1px; height: 2.9rem; font-size: 0.68rem; line-height: 1.05; padding: 0 3px; }
  #view-leccion .seg .btn3d-md svg { width: 1.05rem; height: 1.05rem; }
}

/* ---------------------------------------------------------------- práctica en vivo: explicación */
.live-intro .live-card { margin: 0; width: 100%; max-width: 30rem; max-height: calc(100dvh - 32px); overflow: auto;
  display: grid; justify-items: center; gap: 12px; text-align: center; transform: scale(0.96); transition: transform 300ms var(--ease); }
.live-intro.is-open .live-card { transform: scale(1); }
.live-card h1 { font-size: clamp(1.7rem, 5vw, 2.1rem); }
.live-lead { margin: 0; color: var(--ink-soft); font-size: 1.08rem; font-weight: 700; max-width: 30ch; }
.live-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; width: 100%; text-align: left; }
.live-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--muted); font-weight: 700; }
.live-steps svg { width: 1.6rem; height: 1.6rem; color: var(--go); flex: 0 0 auto; }
.live-note { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.live-card .onboard-actions { width: 100%; }
/* en el teléfono los botones no caben uno al lado del otro: la acción principal arriba, entera */
@media (max-width: 620px) {
  .live-card .onboard-actions { flex-direction: column-reverse; }
  .live-card .onboard-actions .btn3d { flex: 0 0 auto; }
}

/* botón "Práctica en vivo": puntito rojo de "en vivo" */
.live-dot::before {
  content: '';
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin: 0 0.25em 0.08em 0.15em;
  border-radius: 50%;
  background: #e8213f;
  vertical-align: middle;
}
body.mic-mode .live-dot::before { animation: live-blink 1.2s ease-in-out infinite; }
@keyframes live-blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { body.mic-mode .live-dot::before { animation: none; } }

.parent-sub { font-size: 1.15rem; margin: 16px 0 8px; }
.modes-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }

/* afinación acostada: título y explicación arriba, botones abajo a lo ancho (no hay pasos que enseñar) */
@media (orientation: landscape) and (max-height: 520px) {
  #tune-intro .live-card {
    max-width: 46rem;
    grid-template-columns: auto 1fr;
    grid-template-areas: 'icon title' 'lead lead' 'note note' 'actions actions';
    column-gap: 16px;
    row-gap: 8px;
    align-items: center;
  }
  #tune-intro .onboard-icon { grid-area: icon; }
  #tune-intro h1 { grid-area: title; text-align: left; font-size: 1.5rem; }
  #tune-intro .live-lead { grid-area: lead; max-width: none; text-align: left; }
  #tune-intro .live-note { grid-area: note; text-align: left; }
  #tune-intro .onboard-actions { grid-area: actions; }
}

/* teléfono acostado: la explicación en dos columnas para que todo quepa sin scroll */
@media (orientation: landscape) and (max-height: 520px) {
  .live-intro .live-card {
    max-width: 50rem;
    padding: 16px 18px;
    grid-template-columns: 0.9fr 1.1fr;
    grid-template-areas: 'icon steps' 'title steps' 'lead steps' 'note actions';
    align-items: center;
    column-gap: 20px;
    row-gap: 6px;
  }
  .live-card .onboard-icon { grid-area: icon; width: 56px; height: 56px; }
  .live-card .onboard-icon svg { width: 28px; height: 28px; }
  .live-card h1 { grid-area: title; font-size: 1.4rem; }
  .live-card .live-lead { grid-area: lead; font-size: 0.92rem; }
  .live-card .live-steps { grid-area: steps; gap: 6px; margin: 0; }
  .live-card .live-steps li { padding: 7px 10px; font-size: 0.85rem; }
  .live-card .live-note { grid-area: note; font-size: 0.72rem; }
  .live-card .onboard-actions { grid-area: actions; }
  .live-card .onboard-actions .btn3d-lg { height: 3rem; font-size: 0.95rem; }
}

/* iPad: tocar con varios dedos o dejar el dedo apretado seleccionaba texto y sombreaba la pantalla
   (videos de Yereidys, 15 nov). En la lección nada se selecciona y el piano recibe todos los toques. */
#view-leccion, #view-leccion * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
/* solo al tocar en la pantalla; en los otros modos se puede deslizar la página sobre el piano */
body.tablet-mode #view-leccion .stage, body.tablet-mode #view-leccion .stage canvas { touch-action: none; }

/* iPad acostado: la canción usa más ancho para que el piano no se vea flaco */
@media (orientation: landscape) and (min-height: 521px) {
  .shell:has(#view-leccion:not([hidden])) { max-width: 1280px; }
}

/* iPad acostado (y pantallas anchas): el piano ocupa todo el alto a la izquierda y los controles van
   en una columna a la derecha. Antes los botones de abajo le quitaban un tercio del alto. */
@media (orientation: landscape) and (min-height: 521px) and (min-width: 900px) {
  #view-leccion:not([hidden]) {
    display: grid;
    grid-template-columns: 1fr 250px;
    grid-template-rows: auto auto auto 1fr auto;
    column-gap: 18px;
    row-gap: 14px;
  }
  #view-leccion .stage { grid-column: 1; grid-row: 1 / -1; min-height: 0; height: 100%; }
  #view-leccion .lesson-top { grid-column: 2; grid-row: 1; margin: 0; flex-wrap: wrap; }
  #view-leccion .lesson-titles h1 { font-size: 1.5rem; -webkit-line-clamp: 3; }
  #view-leccion .console { grid-column: 2; grid-row: 2; flex-wrap: wrap; margin: 0; gap: 10px; justify-content: space-between; }
  #view-leccion .console .btn3d-xl { order: -1; width: 100%; padding: 0 1rem; }
  #view-leccion .console .btn3d-lgicon { width: calc(50% - 5px); height: 3.6rem; }
  #view-leccion .toggles { grid-column: 2; grid-row: 3; flex-direction: column; gap: 10px; }
  #view-leccion .seg { width: 100%; }
  #view-leccion .seg .btn3d-md { flex: 1; padding: 0 6px; font-size: 0.9rem; }
  #view-leccion .hint { grid-column: 2; grid-row: 5; margin: 0; text-align: left; font-size: 1.05rem; min-height: 0; }
  #view-leccion .teacher-btn { grid-column: 2; grid-row: 4; align-self: start; margin: 0; }
}

/* iPad acostado con las barras de Safari (poco alto): columna más compacta para que nada se salga */
@media (orientation: landscape) and (min-height: 521px) and (max-height: 760px) and (min-width: 900px) {
  #view-leccion:not([hidden]) { row-gap: 10px; }
  #view-leccion .lesson-titles h1 { font-size: 1.2rem; -webkit-line-clamp: 2; }
  #view-leccion .console .btn3d-xl { height: 4.2rem; font-size: 1.35rem; }
  #view-leccion .console .btn3d-lgicon { height: 3rem; }
  #view-leccion .seg .btn3d-md { height: 2.8rem; }
  #view-leccion .hint { font-size: 0.92rem; }
}

/* edad en los primeros pasos */
.age-q { margin: 6px 0 0; font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.age-q span { display: block; font-weight: 700; font-size: 0.85rem; color: var(--ink-soft); }
.age-seg { width: 100%; }
.age-seg .btn3d-md { flex: 1; }

/* afinación con el piano */
.tune-do { display: inline-block; padding: 0 0.5em; border-radius: 0.5em; background: var(--do); color: #fff; }
.tune-meter { width: 100%; height: 14px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.tune-meter div { height: 100%; width: 0; border-radius: 999px; background: var(--go); transition: width 80ms linear; }

/* ---------------------------------------------------------------- Patitas, la mascota */
/* La cara sale de data-mood; data-talk abre la boca y data-blink cierra los ojos (solo en la cara tranquila). */

.pat, .pat-hint::before {
  background: url(../assets/patitas/patitas-idle.webp) center / contain no-repeat;
}
.pat[data-mood='happy'], .pat-hint[data-mood='happy']::before { background-image: url(../assets/patitas/patitas-happy.webp); }
.pat[data-mood='wink'], .pat-hint[data-mood='wink']::before { background-image: url(../assets/patitas/patitas-wink.webp); }
.pat[data-mood='sad'], .pat-hint[data-mood='sad']::before { background-image: url(../assets/patitas/patitas-sad.webp); }
.pat[data-mood='celebrate'], .pat-hint[data-mood='celebrate']::before { background-image: url(../assets/patitas/patitas-celebrate.webp); }
.pat[data-mood='idle'][data-blink], .pat-hint[data-mood='idle'][data-blink]::before { background-image: url(../assets/patitas/patitas-blink.webp); }
.pat[data-mood='idle'][data-talk], .pat-hint[data-mood='idle'][data-talk]::before { background-image: url(../assets/patitas/patitas-talk.webp); }

/* pieles (packs): la misma pose de cada cara, con otros colores */
.pat[data-skin='arcoiris'] { background-image: url(../assets/patitas/skins/arcoiris-idle.webp); }
.pat[data-skin='arcoiris'][data-mood='happy'] { background-image: url(../assets/patitas/skins/arcoiris-happy.webp); }
.pat[data-skin='arcoiris'][data-mood='wink'] { background-image: url(../assets/patitas/skins/arcoiris-wink.webp); }
.pat[data-skin='arcoiris'][data-mood='sad'] { background-image: url(../assets/patitas/skins/arcoiris-sad.webp); }
.pat[data-skin='arcoiris'][data-mood='celebrate'] { background-image: url(../assets/patitas/skins/arcoiris-celebrate.webp); }
.pat[data-skin='arcoiris'][data-mood='idle'][data-blink] { background-image: url(../assets/patitas/skins/arcoiris-blink.webp); }
.pat[data-skin='arcoiris'][data-mood='idle'][data-talk] { background-image: url(../assets/patitas/skins/arcoiris-talk.webp); }

.pat { position: relative; display: block; flex: 0 0 auto; transform-origin: 50% 92%; }

/* Ropa del closet. Cada cara tiene su pose: la capa sigue la cabeza (ajuste medido sobre las imágenes). */
.pat-layer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 128.57%;
  background: center / 100% 100% no-repeat;
  pointer-events: none;
  transform-origin: 49.64% 54.17%;
}
.pat[data-mood='happy'] .pat-layer { transform: translate(2.86%, -4.44%) rotate(0.4deg) scale(1, 0.877); }
.pat[data-mood='wink'] .pat-layer { transform: translate(-4.29%, 0); }
.pat[data-mood='sad'] .pat-layer { transform: scale(0.98, 1); }
.pat[data-mood='celebrate'] .pat-layer { transform: translate(0, -5.56%) scale(1.07, 0.95); }
/* lo del cuerpo y las patas sigue la parte de abajo (ajuste aparte) */
.pat-layer[data-slot='cuerpo'], .pat-layer[data-slot='patas'] { transform-origin: 49.64% 75.18%; }
.pat[data-mood] .pat-layer[data-slot='cuerpo'], .pat[data-mood] .pat-layer[data-slot='patas'] { transform: none; }
.pat[data-mood='happy'] .pat-layer[data-slot='cuerpo'], .pat[data-mood='happy'] .pat-layer[data-slot='patas'] { transform: translate(0.36%, -2.78%) rotate(1.5deg) scale(0.995, 0.96); }
.pat[data-mood='wink'] .pat-layer[data-slot='cuerpo'], .pat[data-mood='wink'] .pat-layer[data-slot='patas'] { transform: translate(-1.25%, 0) rotate(-3deg); }
.pat[data-mood='sad'] .pat-layer[data-slot='cuerpo'], .pat[data-mood='sad'] .pat-layer[data-slot='patas'] { transform: scale(1, 0.75); }
.pat[data-mood='celebrate'] .pat-layer[data-slot='cuerpo'] { transform: translate(0, -6.67%); }
/* al saltar, las patas suben: los zapatos se esconden ese ratito */
.pat[data-mood='celebrate'] .pat-layer[data-slot='patas'] { opacity: 0; }
.pat-onboard { width: 150px; height: 150px; }
.pat-map { width: 80px; height: 80px; }
.map-hello { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* en la lección, el mensaje es lo que dice Patitas: cara a la izquierda, globo blanco */
.pat-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  padding: 4px 16px 4px 4px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 20px;
  text-align: left;
}
.pat-hint::before {
  content: '';
  flex: 0 0 auto;
  width: 3.6em;
  height: 3.6em;
  transform-origin: 50% 92%;
}
.pat-hint:empty { display: none; }
/* en la lección la cara es un elemento de verdad, para que lleve la ropa del closet */
.pat-hint.has-face::before { content: none; }
.pat-hint.has-face:has(> #hint:empty) { display: none; }
.pat-hint-face { width: 3.6em; height: 3.6em; }

/* respira: un rebote suave y continuo, como un peluche vivo */
.pat.pat-alive, .pat-hint.pat-alive::before { animation: pat-breathe 2.6s ease-in-out infinite; }
@keyframes pat-breathe {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  50% { transform: translateY(-2%) scale(1.015, 0.985); }
}
.pat.pat-pop, .pat-hint.pat-pop::before { animation: pat-pop 0.6s var(--ease); }
.pat.pat-droop, .pat-hint.pat-droop::before { animation: pat-droop 0.8s var(--ease); }
.pat.pat-jump, .pat-hint.pat-jump::before { animation: pat-jump 0.9s var(--ease); }
@keyframes pat-pop {
  0%, 100% { transform: none; }
  30% { transform: translateY(-14%) scale(0.94, 1.08); }
  60% { transform: translateY(0) scale(1.08, 0.92); }
  80% { transform: scale(0.98, 1.02); }
}
@keyframes pat-droop {
  0%, 100% { transform: none; }
  30% { transform: translateY(6%) scale(1.04, 0.92) rotate(-5deg); }
  60% { transform: translateY(4%) scale(1.03, 0.94) rotate(4deg); }
}
@keyframes pat-jump {
  0%, 100% { transform: none; }
  15% { transform: scale(1.1, 0.88); }
  40% { transform: translateY(-26%) rotate(-8deg) scale(0.95, 1.06); }
  65% { transform: translateY(-8%) rotate(6deg); }
  85% { transform: scale(1.06, 0.94); }
}

/* Pasada que salió mal: Patitas llora de verdad, en un loop animado (3d/raea/cry.tsx → assets/patitas/patitas-cry.mp4).
   El fondo del video es el blanco de la tarjeta, así que no se ve el borde. */
.celebrate-card .pat-cry { display: block; width: 168px; height: 168px; margin: -8px auto 0; object-fit: contain; background: var(--card); pointer-events: none; }
.celebrate-card .pat-cry[hidden] { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  .celebrate-card .pat-cry { grid-row: 1; align-self: end; width: 96px; height: 96px; margin: 0; }
}

/* Borde rojo al fallar una nota o tocar la equivocada: app/stage-glow.js (puerto de "Pulsing Border", 21st.dev).
   Encima del piano y debajo de la isla de Patitas; no recibe toques. */
#view-leccion .stage .stage-glow, .stage .stage-glow { position: absolute; inset: 0; top: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; border-radius: inherit; }
/* sin WebGL o con movimiento reducido: el mismo borde, quieto, que se apaga */
.stage.is-slip::after {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 0 3px #e8213f, inset 0 0 28px 6px rgba(232, 33, 63, 0.45);
  animation: stage-slip 0.8s ease-out forwards;
}
@keyframes stage-slip { from { opacity: 1; } to { opacity: 0; } }

/* columnas angostas del modo acostado: la cara un poco más chica, el globo ocupa su celda */
@media (orientation: landscape) and (max-height: 520px) {
  #view-leccion .pat-hint { padding: 3px 10px 3px 3px; border-radius: 14px; margin: 0; width: auto; }
  #view-leccion .pat-hint::before, #view-leccion .pat-hint-face { width: 2.8em; height: 2.8em; }
}
@media (max-width: 620px) {
  .pat-map { width: 66px; height: 66px; }
  #view-leccion .pat-hint::before, #view-leccion .pat-hint-face { width: 3.1em; height: 3.1em; }
}
@media (prefers-reduced-motion: reduce) {
  .pat, .pat-hint::before { animation: none !important; }
}

/* ================================================================ recompensas
   Rango, metas del día, celebración y medallas. Todo hereda los tokens del kit:
   crema, tinta cálida y el oro del botón de terminar. Nada inventado. */

/* ---------------------------------------------------------------- rango */

.rank-strip {
  margin: 0 0 16px;
  padding: 14px 18px 16px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 12px 32px -18px rgba(42, 33, 24, 0.25);
}

.rank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 1.2rem;
  color: var(--ink);
}

.rank-badge svg { width: 1.4rem; height: 1.4rem; color: var(--gold-deep); stroke-width: 1.9; }
/* los rangos altos se pintan de oro, pero sin rellenar los íconos de trazo */
.rank-badge[data-rank='2'] svg,
.rank-badge[data-rank='3'] svg,
.rank-badge[data-rank='4'] svg,
.rank-badge[data-rank='5'] svg { color: var(--gold); }

.rank-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--muted);
  color: var(--ink-soft);
  font: inherit;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 180ms var(--ease), color 180ms var(--ease);
}

.rank-link svg { width: 1.05rem; height: 1.05rem; }
@media (hover: hover) { .rank-link:hover { background: #eae0cf; color: var(--ink); } }
.rank-link:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.rank-bar {
  height: 12px;
  margin-top: 12px;
  border-radius: 999px;
  background: #f1e7d6;
  overflow: hidden;
}

.rank-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width 420ms var(--ease);
}

.rank-next {
  margin: 8px 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.rank-boost {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  margin: 8px 0 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff0e2;
  color: #a8440a;
  font-size: 0.85rem;
  font-weight: 800;
}

.rank-boost svg { width: 1rem; height: 1rem; flex: 0 0 auto; }

/* ---------------------------------------------------------------- metas del día */

.quests-card {
  margin: 0 0 18px;
  padding: 16px 18px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 12px 32px -18px rgba(42, 33, 24, 0.25);
}

.quests-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quests-head h2 { font-size: 1.3rem; }
.quests-count {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.quests-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }

.quest {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 4px 0;
}

.quest-check {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: #fff;
}

.quest-check svg { width: 0.95rem; height: 0.95rem; stroke-width: 3; }
.quest-text { display: grid; line-height: 1.25; }
.quest-text b { font-weight: 800; font-size: 0.98rem; }
.quest-text small { font-size: 0.82rem; color: var(--ink-soft); font-weight: 600; }
.quest.is-done .quest-check { background: var(--go); border-color: var(--go); }
.quest.is-done .quest-text b { color: var(--ink-soft); text-decoration: line-through; text-decoration-thickness: 2px; }

.quests-prize {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff4d6;
  color: var(--gold-deep);
  font-weight: 800;
  font-size: 0.92rem;
}

.quests-prize svg { width: 1.2rem; height: 1.2rem; }

/* ---------------------------------------------------------------- medallas */

.logros { display: grid; gap: 16px; }

.logros-head {
  padding: 20px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 12px 32px -18px rgba(42, 33, 24, 0.25);
}

.logros-rank { display: flex; align-items: center; gap: 12px; }

.logros-rank-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff4d6;
  color: var(--gold-deep);
}

.logros-rank-icon svg { width: 1.7rem; height: 1.7rem; }
.logros-title { margin: 0; font-family: var(--display); font-size: 1.6rem; line-height: 1.1; }
.logros-notes { margin: 3px 0 0; font-size: 0.92rem; font-weight: 700; color: var(--ink-soft); }

.logros-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.logros-stats span {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.logros-stats b { font-family: var(--display); color: var(--ink); font-size: 0.98rem; }

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}

.badge {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 16px 12px;
  border-radius: 20px;
  background: #fbf6ee;
  border: 2px dashed var(--line);
  text-align: center;
}

.badge.is-owned { background: #fff7e3; border: 2px solid #f0d59a; }

.badge-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f0e7d8;
  color: #b3a390;
}

.badge.is-owned .badge-icon { background: var(--gold); color: #fff; }
.badge-icon svg { width: 1.3rem; height: 1.3rem; }
.badge b { font-size: 0.93rem; line-height: 1.2; }
.badge small { font-size: 0.78rem; line-height: 1.25; color: var(--ink-soft); font-weight: 600; }
.badge.is-owned b { color: var(--ink); }

.logros-extras {
  padding: 20px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 12px 32px -18px rgba(42, 33, 24, 0.25);
}

.logros-extras h2 { font-size: 1.35rem; margin-bottom: 10px; }

.logros-shield {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.logros-shield svg { width: 1.2rem; height: 1.2rem; color: #a8440a; }
.logros-shield.is-empty svg { color: #c9bba6; }
.shield-shop { display: grid; justify-items: start; gap: 6px; margin: 0 0 16px; }
.shield-shop small { font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); }
.shield-shop .btn3d svg { width: 1.1em; height: 1.1em; }
.shield-shop .btn3d.is-confirm { background: var(--gold); color: var(--ink); }

.sticker-book { display: flex; flex-wrap: wrap; gap: 10px; }
.sticker-book .pat { width: 64px; height: 64px; }
.logros-empty { margin: 0; font-weight: 700; color: var(--ink-soft); font-size: 0.92rem; }

/* ---------------------------------------------------------------- celebración */

.celebrate {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(30, 24, 16, 0.6);
  opacity: 0;
  transition: opacity 220ms var(--ease);
}

.celebrate.is-open { opacity: 1; }

.celebrate-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 24px 22px 20px;
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 24px 60px -20px rgba(30, 24, 16, 0.55);
  text-align: center;
  overflow: hidden;
  /* nunca más alta que la pantalla: la lista se desplaza por dentro y "Seguir" siempre se ve */
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 32px);
  transform: scale(0.94) translateY(10px);
  transition: transform 260ms var(--ease);
}

.celebrate.is-open .celebrate-card { transform: none; }
.celebrate-card .pat-celebrate { width: 104px; height: 104px; margin: 0 auto 6px; }

.celebrate-kicker {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.celebrate h2 { margin: 4px 0 0; font-size: clamp(1.7rem, 6vw, 2.2rem); }

.celebrate-stars { display: flex; justify-content: center; gap: 10px; margin: 14px 0 2px; color: #e3d8c6; }
.celebrate-stars svg { width: 2.9rem; height: 2.9rem; stroke-width: 1.1; }
.celebrate-stars .on { color: var(--gold); stroke: var(--gold-deep); animation: star-pop 480ms var(--ease) both; }

@keyframes star-pop {
  0% { transform: scale(0) rotate(-50deg); opacity: 0; }
  65% { transform: scale(1.28) rotate(8deg); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

.celebrate-notas {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 0;
  font-family: var(--display);
  color: var(--go);
}

.celebrate-notas b { font-size: 2.5rem; line-height: 1; }
.celebrate-stats:not([hidden]) { display: flex; justify-content: center; gap: 24px; }
.celebrate-stats .celebrate-notas b { font-size: 1.6rem; color: var(--ink); }
.celebrate-notas span { font-size: 1rem; color: var(--ink-soft); }

.celebrate-list {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 16px 0 18px;
  padding: 0;
  text-align: left;
}

.celebrate-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}

.celebrate-list svg { width: 1.05rem; height: 1.05rem; margin-top: 2px; color: var(--gold-deep); flex: 0 0 auto; }
.celebrate-list:empty { display: none; }
.celebrate .onboard-actions { margin-top: 4px; }
.celebrate-card > * { flex-shrink: 0; }
.celebrate-card > .celebrate-list { flex-shrink: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* teléfono acostado: dos columnas (cara y premio a la izquierda, lista y botones a la derecha) */
@media (orientation: landscape) and (max-height: 520px) {
  .celebrate { padding: 10px; }
  .celebrate-card {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    grid-template-rows: 1fr auto auto auto auto 1fr auto;
    column-gap: 18px;
    max-width: 760px;
    height: calc(100dvh - 20px);
    max-height: none;
    padding: 14px 18px;
  }
  .celebrate-card > :not(.confetti) { grid-column: 1; }
  .celebrate-card .pat-celebrate { grid-row: 1; align-self: end; width: 64px; height: 64px; margin-bottom: 2px; }
  .celebrate h2 { font-size: 1.5rem; }
  .celebrate-stars { margin: 8px 0 0; gap: 6px; }
  .celebrate-stars svg { width: 2rem; height: 2rem; }
  .celebrate-notas b { font-size: 1.9rem; }
  .celebrate-card > .celebrate-list { grid-column: 2; grid-row: 1 / 7; align-self: start; max-height: 100%; margin: 0 0 10px; }
  .celebrate-list li { padding: 6px 10px; font-size: 0.88rem; }
  .celebrate-card > .onboard-actions { grid-column: 2; grid-row: 7; margin: 0; }
  .celebrate-card:has(.celebrate-list[hidden], .celebrate-list:empty) > .onboard-actions { grid-column: 1 / -1; }
}

.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
  position: absolute;
  top: -14px;
  left: var(--x, 0%);
  width: 7px;
  height: 12px;
  border-radius: 2px;
  background: var(--c, var(--gold));
  transform: rotate(var(--r, 0deg));
  opacity: 0;
  animation: confetti-fall 1150ms var(--d, 0ms) cubic-bezier(0.25, 0.6, 0.4, 1) forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(var(--r, 0deg)); opacity: 1; }
  100% { transform: translateY(320px) rotate(calc(var(--r, 0deg) + 240deg)); opacity: 0; }
}

/* ---------------------------------------------------------------- padres */

.parent-lead { margin: 0 0 10px; color: var(--ink-soft); font-weight: 700; font-size: 0.95rem; }
.steps-note { margin: 10px 0 0; color: var(--ink-soft); font-weight: 700; font-size: 0.92rem; }

.log-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.log-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.92rem;
}
.log-list b { color: var(--go); }
.cert-copy-alt { font-size: 0.95rem; color: var(--ink-soft); }

/* ---------------------------------------------------------------- pantallas chicas */

/* la cabecera del mapa se apila antes que el resto: los contadores necesitan su renglón */
@media (max-width: 860px) {
  .map-top { flex-direction: column; align-items: stretch; gap: 12px; }
  .map-top-right { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .rank-strip { padding: 12px 14px 14px; }
  .quests-card { padding: 14px; }
  .badge-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
  .celebrate-stars svg { width: 2.5rem; height: 2.5rem; }
  .celebrate-card { padding: 20px 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .rank-fill { transition: none; }
  .celebrate, .celebrate-card { transition: none; }
  .celebrate-stars .on { animation: none; transform: none; opacity: 1; }
  .confetti { display: none; }
}

/* El botón que lleva a la próxima estrella late (Patitas lo dice en la burbuja). */
.btn3d.is-nudge { position: relative; overflow: visible; }
.btn3d.is-nudge::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 3px solid var(--gold);
  pointer-events: none;
  animation: ring 1.4s var(--ease) infinite;
}
@media (prefers-reduced-motion: reduce) { .btn3d.is-nudge::after { animation: none; opacity: 0.8; } }

/* ---------------------------------------------------------------- las cinco estrellas como pasos
   Steps de 21st.dev (adit-firdaus), en su orientación horizontal: una fila de marcadores rellenos
   (sin bordes), el actual con halo, y la vía entre dos se llena de oro al ganar el de la izquierda.
   Horizontal porque en vertical cinco pasos le quitaban medio alto al piano (17 nov). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.lesson-top { flex-wrap: wrap; }
.star-steps {
  --mk: 1.9rem; /* tamaño del marcador: la vía pasa por su centro */
  position: relative;
  flex-basis: 100%;
  display: flex;
  list-style: none;
  margin: 2px 0 0;
  padding: 10px 6px 8px;
  background: var(--card);
  border-radius: 1.1rem;
  box-shadow: var(--bevel-light);
}
.star-steps[hidden], .star-steps__step[hidden] { display: none; }
/* una sola vía, del centro de la primera estrella al de la última (stepper-03: left/right 1/2n) */
.star-steps__rail {
  position: absolute;
  top: calc(10px + var(--mk) / 2 - 1.5px);
  left: calc(6px + (100% - 12px) / (2 * var(--n, 5)));
  width: calc((100% - 12px) * (var(--n, 5) - 1) / var(--n, 5));
  height: 3px;
  border-radius: 2px;
  background: var(--line);
}
.star-steps__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--gold);
  transform: scaleX(var(--steps-progress, 0));
  transform-origin: left;
  transition: transform 700ms cubic-bezier(0.34, 1.25, 0.64, 1); /* resorte 120/20 */
}
.star-steps__dot {
  position: absolute;
  top: 50%;
  left: calc(var(--steps-progress, 0) * 100%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-deep);
  transform: translate(-50%, -50%);
  transition: left 650ms cubic-bezier(0.34, 1.2, 0.64, 1); /* resorte 160/24 */
}
.star-steps__step {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}
.star-steps__marker {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: var(--mk);
  height: var(--mk);
  border-radius: 50%;
  background: var(--muted);
  color: #e6dccb;
  transition: background-color 300ms var(--ease), color 300ms var(--ease), transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.star-steps__marker svg { width: 62%; height: 62%; }
.star-steps__step[data-status='complete'] .star-steps__marker { background: var(--gold); color: #fff; }
.star-steps__step[data-status='current'] .star-steps__marker { background: #fff3d6; color: var(--gold-deep); transform: scale(1.1); }
/* el halo que late en la estrella que sigue */
.star-steps__step[data-status='current'] .star-steps__marker::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(242, 182, 50, 0.55);
  animation: step-pulse 2.2s ease-in-out infinite alternate;
}
@keyframes step-pulse { from { transform: scale(1); opacity: 1; } to { transform: scale(1.45); opacity: 0.2; } }
/* la estrella recién ganada entra girando con resorte */
.star-steps__step[data-new] .star-steps__marker svg { animation: step-star-in 520ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes step-star-in { from { transform: scale(0) rotate(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
.star-steps__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.74rem;
  line-height: 1.1;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.star-steps__step[data-status='upcoming'] .star-steps__title { color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) {
  .star-steps__fill, .star-steps__dot, .star-steps__marker { transition: none; }
  .star-steps__step .star-steps__marker::after, .star-steps__step[data-new] .star-steps__marker svg { animation: none; }
}
/* teléfono acostado: no hay sitio; Patitas lo dice en la burbuja */
@media (orientation: landscape) and (max-height: 520px) { #view-leccion .star-steps { display: none; } }
/* iPad acostado: columna angosta, solo los marcadores (Patitas dice el siguiente) */
@media (orientation: landscape) and (min-height: 521px) {
  #view-leccion .star-steps { --mk: 1.6rem; padding: 8px 4px; }
  #view-leccion .star-steps__rail { top: calc(8px + var(--mk) / 2 - 1.5px); left: calc(4px + (100% - 8px) / (2 * var(--n, 5))); width: calc((100% - 8px) * (var(--n, 5) - 1) / var(--n, 5)); }
  #view-leccion .star-steps__title { display: none; }
}

/* el reto De memoria aparece cuando la canción ya es suya */
.seg[hidden] { display: none; }
.seg-memory .btn3d { flex: 1; }
/* memoria asistida: cuánto de la canción ya está en la memoria */
.mem-pct { margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: rgba(42, 33, 24, 0.1); font-size: 0.85em; font-variant-numeric: tabular-nums; }
.mem-pct[hidden] { display: none; }

/* ---------------------------------------------------------------- pantalla de inicio
   Franja en el mapa (misma tarjeta y botones del kit) y pasos numerados en la guía. */
.install-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 12px 12px 14px;
}
.install-strip[hidden] { display: none; }
.install-strip p { margin: 0; flex: 1; font-size: 0.92rem; line-height: 1.3; color: var(--ink-soft); }
.install-strip p b { color: var(--ink); }
.install-strip-icon { flex: 0 0 auto; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: #e7f6ec; color: var(--go); }
.install-strip-icon svg { width: 1.3rem; height: 1.3rem; }
.install-strip-close { flex: 0 0 auto; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); cursor: pointer; }
.install-strip-close svg { width: 1.1rem; height: 1.1rem; }
.install-steps { counter-reset: paso; }
.install-steps li { counter-increment: paso; }
.install-steps li::before {
  content: counter(paso);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--go);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.9rem;
}
.install-steps li span { flex: 1; }

/* instalar primero: la misma tarjeta de los primeros pasos */
.install-first { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 30rem; margin: 2vh auto 0; }
.install-first .install-steps { width: 100%; }
.install-first #first-install { width: 100%; }
.install-skip { margin-top: 4px; padding: 10px; border: 0; background: none; color: var(--ink-soft); font: inherit; font-size: 0.92rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------------------------------------------------------------- guía animada para instalar
   Teléfono dibujado (Screenshot Capture de 21st.dev, uicapsule, portado): marco crema con botones
   a los lados, destello blanco y la pantalla que se encoge a miniatura con borde blanco (resorte,
   bounce 0.22, 650 ms, 120 ms de espera) y se va a la izquierda. Patitas mira desde el lado. */
.install-demo { width: 100%; display: flex; justify-content: center; }
.idemo { position: relative; padding: 4px 56px 8px; }
.idemo-phone {
  position: relative; width: 176px; aspect-ratio: 9 / 19.5; padding: 6px;
  border-radius: 36px; background: linear-gradient(145deg, #efe7da, #d9cdb9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 18px 34px rgba(42, 33, 24, 0.22), 0 4px 10px rgba(42, 33, 24, 0.12);
}
.idemo[data-os='android'] .idemo-phone { border-radius: 26px; background: linear-gradient(145deg, #3a3631, #1f1c19); }
.idemo-side { position: absolute; width: 3px; border-radius: 2px; background: #d3c6b0; }
.idemo[data-os='android'] .idemo-side { background: #2a2622; }
.idemo-side.is-l1 { left: -3px; top: 22%; height: 9%; }
.idemo-side.is-l2 { left: -3px; top: 34%; height: 9%; }
.idemo-side.is-r { right: -3px; top: 28%; height: 13%; }
.idemo[data-os='android'] .idemo-side.is-l1, .idemo[data-os='android'] .idemo-side.is-l2 { display: none; }
.idemo-screen { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 30px; background: #0f1a2b; isolation: isolate; }
.idemo[data-os='android'] .idemo-screen { border-radius: 20px; }
.idemo-cam { position: absolute; z-index: 40; top: 7px; left: 50%; width: 52px; height: 15px; border-radius: 10px; background: #000; transform: translateX(-50%); }
.idemo[data-os='android'] .idemo-cam { width: 9px; height: 9px; top: 8px; }

/* la página del kit dentro del navegador dibujado */
.idemo-page, .idemo-shot { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.idemo-chrome { display: contents; }
.idemo-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: #f7f3ea; color: #3c3329; }
.idemo-bar.is-top { order: 0; padding-top: 26px; border-bottom: 1px solid var(--line); }
.idemo-bar.is-bottom { order: 2; flex-direction: column; align-items: stretch; padding-bottom: 12px; border-top: 1px solid var(--line); }
.idemo-icons { display: flex; justify-content: space-between; padding: 2px 0 0; }
.idemo-url { flex: 1; display: flex; align-items: center; justify-content: center; gap: 3px; height: 20px; border-radius: 7px; background: #e9e2d4; font-size: 8.5px; font-weight: 700; color: #5c5044; }
.idemo-url.is-title { justify-content: flex-start; background: none; font-size: 11px; color: var(--ink); }
.idemo-url svg { width: 8px; height: 8px; }
.idemo-ico { position: relative; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; transition: background 0.2s; }
.idemo-ico svg, .idemo-row svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.idemo-ico svg.is-fill { fill: currentColor; stroke: none; }
.idemo-ico[data-ico='share'], .idemo-ico[data-ico='more'], .idemo-ico[data-ico='lines'], .idemo-ico[data-ico='dots'] { color: #0a7cff; }
.idemo [data-pressed] { background: rgba(10, 124, 255, 0.18); }
.idemo-site { order: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; font-family: var(--display); font-size: 13px; color: var(--ink); }
.idemo-site-pat { width: 54px; height: 54px; background: url(../assets/patitas/patitas-happy.webp) center / contain no-repeat; }
.idemo-site-dots { display: flex; gap: 4px; }
.idemo-site-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--do); }
.idemo-site-dots i:nth-child(2) { background: var(--re); }
.idemo-site-dots i:nth-child(3) { background: var(--mi); }
.idemo-site-dots i:nth-child(4) { background: var(--fa); }
.idemo-site-dots i:nth-child(5) { background: var(--sol); }
.idemo-site-btn { margin-top: 4px; padding: 4px 16px; border-radius: 999px; background: var(--go); color: #fff; font-size: 11px; }

/* la lista que se abre: hoja de abajo (Safari, Samsung) o menú de arriba (Chrome, Instagram) */
.idemo-sheet { position: absolute; z-index: 20; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: #fff; color: var(--ink); font-size: 9.5px; font-weight: 700; opacity: 0; pointer-events: none; transition: transform 0.45s var(--ease), opacity 0.3s; }
.idemo-sheet.is-sheet { left: 0; right: 0; bottom: 0; padding-bottom: 16px; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18); transform: translateY(100%); }
.idemo-sheet.is-menu { top: 30px; right: 6px; width: 70%; border-radius: 10px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22); transform: scale(0.85); transform-origin: top right; }
.idemo-sheet[data-open] { opacity: 1; transform: none; }
.idemo-row { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 8px; background: #f6f1e8; transition: background 0.2s; }
.idemo-row.is-pick { background: #e7f6ec; color: #0d5a22; box-shadow: 0 0 0 1.5px var(--go) inset; }
.idemo-row.is-pick[data-pressed] { background: #c9ecd5; }

.idemo-dialog { position: absolute; z-index: 25; left: 10px; right: 10px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 10px; border-radius: 14px; background: #fff; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25); font-size: 9.5px; color: var(--ink); opacity: 0; transition: transform 0.45s var(--ease), opacity 0.3s; }
.idemo-dialog.is-top { top: 30px; transform: translateY(-12px); }
.idemo-dialog.is-bottom { bottom: 22px; transform: translateY(12px); }
.idemo-dialog[data-open] { opacity: 1; transform: none; }
.idemo-dialog-head { display: flex; align-items: center; gap: 6px; }
.idemo-dialog-head img { width: 22px; height: 22px; border-radius: 6px; }
.idemo-dialog-btn { padding: 4px 9px; border-radius: 999px; background: #0a7cff; color: #fff; font-weight: 800; }
.idemo-dialog-btn[data-pressed] { background: #075fc4; }

/* el dedo que toca */
.idemo-finger { position: absolute; z-index: 35; left: 0; top: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 3px 10px rgba(0, 0, 0, 0.3); opacity: 0; transform: translate(var(--fx, 88px), var(--fy, 220px)) scale(1); transition: transform 0.6s var(--ease), opacity 0.3s; }
.idemo-finger[data-on] { opacity: 1; }
.idemo-finger[data-tap] { transform: translate(var(--fx), var(--fy)) scale(0.72); transition-duration: 0.6s, 0.3s; }
.idemo-finger[data-tap]::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid #fff; animation: idemo-ring 0.45s ease-out forwards; }
@keyframes idemo-ring { from { opacity: 1; transform: scale(0.6); } to { opacity: 0; transform: scale(1.6); } }

/* destello y miniatura (Screenshot Capture) */
.idemo-flash { position: absolute; inset: 0; z-index: 30; background: #fff; opacity: 0; pointer-events: none; }
.idemo-flash[data-go] { animation: idemo-flash 0.45s ease-out; }
@keyframes idemo-flash { from { opacity: 0.95; } to { opacity: 0; } }
.idemo-shot { z-index: 28; visibility: hidden; border-radius: 30px; transform-origin: center; }
.idemo-shot[data-state] { visibility: visible; }
.idemo-shot[data-state='thumb'] {
  border-radius: 40px; box-shadow: 0 0 0 10px #fff, 0 20px 40px rgba(0, 0, 0, 0.8);
  transform: translate(calc(-50% + 50% * 0.2 + 6px), calc(50% - 50% * 0.2 - 14px)) scale(0.2);
  transition: transform 0.65s cubic-bezier(0.34, 1.36, 0.64, 1) 0.12s, border-radius 0.65s 0.12s;
}
.idemo-shot[data-state='gone'] {
  opacity: 0; border-radius: 40px; box-shadow: 0 0 0 10px #fff;
  transform: translate(calc(-50% + 50% * 0.2 + 6px - 260px), calc(50% - 50% * 0.2 - 14px)) scale(0.2);
  transition: transform 0.25s ease-in, opacity 0.25s ease-in;
}

/* la pantalla de inicio con el ícono nuevo */
.idemo-home { position: absolute; inset: 0; padding: 34px 12px 12px; background: radial-gradient(circle at 70% 18%, #f2b632 0%, #f08c2e 22%, transparent 48%), radial-gradient(circle at 40% 120%, #4b2a8c 0%, transparent 60%), #1e1810; }
.idemo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 10px; }
.idemo-tile { aspect-ratio: 1; border-radius: 10px; background: hsl(var(--h) 35% 62% / 0.55); }
.idemo-app { display: flex; flex-direction: column; align-items: center; gap: 3px; opacity: 0; transform: scale(0.3); }
.idemo-app img { width: 100%; aspect-ratio: 1; border-radius: 10px; box-shadow: 0 0 0 2px #fff, 0 6px 14px rgba(0, 0, 0, 0.4); }
.idemo-app small { font-size: 6.5px; font-weight: 800; color: #fff; white-space: nowrap; }
.idemo-app[data-pop] { animation: idemo-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s forwards; }
@keyframes idemo-pop { to { opacity: 1; transform: none; } }

/* Patitas mira desde el lado del teléfono */
.idemo-pat { position: absolute; right: -18px; bottom: 0; width: 80px; height: 80px; z-index: 2; }

/* el paso de la lista que va sonando en el teléfono */
.install-steps li { transition: background 0.3s, box-shadow 0.3s; }
.install-steps li[data-now] { background: #e7f6ec; box-shadow: 0 0 0 2px var(--go) inset; }
.install-first:has(.install-demo:not([hidden])) #pat-install { display: none; }
@media (max-height: 700px) { .idemo-phone { width: 150px; } .idemo-pat { width: 74px; height: 74px; } }

/* tableta: marco más ancho (3:4), bordes parejos, cámara chiquita arriba y la barra del navegador arriba */
.idemo[data-device='tablet'] { padding: 4px 34px 8px; }
.idemo[data-device='tablet'] .idemo-phone { width: 248px; aspect-ratio: 3 / 4; padding: 9px; border-radius: 22px; }
.idemo[data-device='tablet'] .idemo-screen { border-radius: 13px; }
.idemo[data-device='tablet'] .idemo-side.is-l1, .idemo[data-device='tablet'] .idemo-side.is-l2 { display: none; }
.idemo[data-device='tablet'] .idemo-side.is-r { right: auto; left: 70%; top: -3px; width: 13%; height: 3px; }
.idemo[data-device='tablet'] .idemo-cam { top: 3px; width: 5px; height: 5px; background: #2a2622; }
.idemo[data-device='tablet'] .idemo-bar.is-top { padding-top: 8px; }
.idemo[data-device='tablet'] .idemo-sheet.is-menu { top: 32px; width: 52%; }
.idemo[data-device='tablet'] .idemo-dialog.is-center { top: 50%; left: 18%; right: 18%; transform: translateY(-40%); }
.idemo[data-device='tablet'] .idemo-dialog.is-center[data-open] { transform: translateY(-50%); }
.idemo[data-device='tablet'] .idemo-home { padding: 18px 14px; }
.idemo[data-device='tablet'] .idemo-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.idemo[data-device='tablet'] .idemo-pat { right: -26px; }
@media (max-width: 380px) { .idemo[data-device='tablet'] .idemo-phone { width: 220px; } }
/* en pantallas grandes (tableta) la guía se ve más grande */
@media (min-width: 700px) { .install-demo .idemo { zoom: 1.45; } }

/* Safari de iOS 26: una sola barra abajo (atrás · dirección · •••) y el menú sale encima del ••• */
.idemo-bar.is-bottom.is-row { flex-direction: row; align-items: center; padding-bottom: 14px; }
.idemo-sheet.is-pop { right: 6px; bottom: 46px; width: 62%; border-radius: 12px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22); transform: scale(0.85); transform-origin: bottom right; }
/* el aviso de Apple con el interruptor "Abrir como app web" encendido */
.idemo-dialog { flex-wrap: wrap; }
.idemo-toggle { flex: 1 0 100%; display: flex; align-items: center; justify-content: space-between; padding-top: 7px; border-top: 1px solid var(--line); font-weight: 700; }
.idemo-toggle i { position: relative; width: 22px; height: 13px; border-radius: 7px; background: #34c759; }
.idemo-toggle i::after { content: ''; position: absolute; top: 1.5px; right: 1.5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.idemo-dialog-head { flex: 1; min-width: 0; }
.idemo-dialog-head b { font-size: 9px; }

/* ---------------------------------------------------------------- la maestra animada
   Marioneta de Yereidys: caras apiladas (la boca cambia con su voz), poses que entran con un fundido,
   un tecladito con los colores del kit que se enciende cuando ella nombra la tecla, y subtítulos. */
.maestra { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 420px; margin: 0 auto; }
.maestra-stage { position: relative; width: 100%; aspect-ratio: 928 / 1152; border-radius: 22px; overflow: hidden; background: #f6ecdc; box-shadow: 0 14px 30px rgba(42, 33, 24, 0.16); }
.maestra-face, .maestra-pose { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.maestra-face.is-on { opacity: 1; }
.maestra-pose { transition: opacity 0.22s ease; z-index: 2; }
.maestra-pose.is-on { opacity: 1; }
.maestra-keys { position: relative; display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; width: 100%; height: 74px; padding: 6px; border-radius: 14px; background: #2a2118; }
.maestra-key { position: relative; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; border-radius: 0 0 7px 7px; background: linear-gradient(var(--k) 0 26%, #f7f3ea 26%); font: 800 12px var(--ui); color: var(--ink); transition: transform 0.12s, filter 0.12s, box-shadow 0.12s; }
.maestra-key.is-lit { background: var(--k); color: #fff; transform: translateY(2px); box-shadow: 0 0 0 3px #fff8ec inset, 0 0 18px var(--k); }
.maestra-black { position: absolute; top: 6px; left: calc(6px + (100% - 12px) / 8 * var(--x) - 9px); width: 18px; height: 40%; border-radius: 0 0 5px 5px; background: #120e0a; }
.maestra-caption { min-height: 3.2em; margin: 0; text-align: center; font: 700 1rem/1.45 var(--ui); color: var(--ink); }
/* la mano de la maestra sobre el tecladito (el arte de la mano del kit); el teclado crece para que quepa la palma */
.maestra-keys { height: 92px; overflow: visible; margin-bottom: 70px; }
.maestra-hand { position: absolute; z-index: 3; pointer-events: none; opacity: 0; transition: opacity 0.25s ease; filter: drop-shadow(0 6px 8px rgba(42, 33, 24, 0.25)); }
.maestra-hand.is-on { opacity: 1; }
/* la palma se corta un poco debajo del teclado: se ve apoyada sin tapar los subtítulos */
.maestra-keys { margin-bottom: 34px; clip-path: inset(-60px -40px -30px -40px round 14px); }
/* la mano 3D de las canciones sobre el tecladito: su capa cubre el teclado y un poco debajo (la palma) */
.maestra-hand3d { position: absolute; left: 0; right: 0; top: -20px; height: calc(100% + 80px); pointer-events: none; z-index: 3; }
.maestra-keys.has-hand3d { height: 130px; clip-path: none; margin-bottom: 64px; }
/* el nombre de la nota arriba, en la banda de color (como en las canciones): la mano apoya debajo y no lo tapa */
.maestra-key { align-items: flex-start; padding: 7px 0 0; background: linear-gradient(var(--k) 0 34%, #f7f3ea 34%); }
.maestra-key b { color: var(--ink); font-size: 12px; line-height: 1; position: relative; z-index: 1; }
.maestra-key.is-lit b { color: var(--ink); }
.maestra-black { height: 30%; z-index: 2; }
/* que todo quepa en una pantalla: el retrato se ajusta al alto disponible (teléfonos bajitos incluidos) */
.maestra-stage { width: min(100%, calc((100dvh - 400px) * 928 / 1152)); min-width: 200px; align-self: center; }

/* la ventana de la maestra (mismo fondo y entrada que el video de la maestra) */
.maestra-box { position: relative; width: 100%; max-width: 28rem; max-height: calc(100dvh - 32px); overflow: auto; padding: 18px 16px 16px; border-radius: 1.5rem; background: var(--bg); border: 1px solid var(--line); box-shadow: 0 30px 60px -20px rgba(42, 33, 24, 0.5); transform: scale(0.92); opacity: 0; transition: transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 400ms; }
.video-modal.is-open .maestra-box { transform: none; opacity: 1; }
.maestra-box .video-close { top: 10px; right: 10px; width: 40px; height: 40px; background: rgba(42, 33, 24, 0.55); }
#maestra-go { width: 100%; margin-top: 12px; }
#maestra-go[hidden] { display: none; }
.maestra-box .maestra-stage { width: min(100%, calc((100dvh - 430px) * 928 / 1152)); }

/* "Ver a la maestra": botoncito redondo con su cara en la esquina del encabezado (antes era un banner) */
.lesson-top .teacher-btn { margin: 0; padding: 0; width: 3.25rem; height: 3.25rem; border-radius: 50%; border: 3px solid #fff; background: var(--muted); box-shadow: 0 2px 8px rgba(42, 33, 24, 0.18); overflow: visible; position: relative; flex: 0 0 auto; align-self: center; }
.lesson-top .teacher-thumb { width: 100%; height: 100%; border-radius: 50%; background: #f6ecdc; }
.lesson-top .teacher-thumb img { object-position: 50% 18%; transform: scale(1.35); transform-origin: 50% 25%; }
.lesson-top .teacher-play { inset: auto -4px -4px auto; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--go); border: 2px solid #fff; }
.lesson-top .teacher-play svg { width: 0.6rem; height: 0.6rem; color: #fff; fill: #fff; filter: none; }
#view-leccion .lesson-top .teacher-btn { grid-column: auto; grid-row: auto; margin: 0; justify-self: auto; align-self: center; }
@media (orientation: landscape) and (max-height: 520px) { .lesson-top .teacher-btn { width: 2.6rem; height: 2.6rem; } }

/* el globito de la maestra: sale debajo de su carita, con la colita apuntándole */
.lesson-top { position: relative; }
.maestra-bubble { position: absolute; top: calc(100% - 4px); right: 0; z-index: 6; max-width: 15rem; padding: 9px 13px; border: 0; border-radius: 14px; background: var(--card); color: var(--ink); font: 700 0.9rem/1.3 var(--ui); text-align: left; box-shadow: 0 8px 22px rgba(42, 33, 24, 0.18); cursor: pointer; opacity: 0; transform: translateY(-6px) scale(0.96); transform-origin: top right; transition: opacity 0.25s ease, transform 0.25s ease; }
.maestra-bubble::before { content: ''; position: absolute; top: -7px; right: 18px; width: 14px; height: 14px; background: var(--card); transform: rotate(45deg); border-radius: 3px; }
.maestra-bubble.is-on { opacity: 1; transform: none; }
.maestra-bubble[hidden] { display: none; }
/* la X siempre encima: la pose del pulgar arriba ya no la tapa al aparecer */
.maestra-box .video-close { z-index: 10; }
.maestra-stage { isolation: isolate; }
@media (prefers-reduced-motion: reduce) { .maestra-bubble { transition: none; } }
/* el globito cuelga de su carita, no del encabezado entero */
.teacher-wrap { position: relative; flex: 0 0 auto; margin-left: auto; display: flex; align-self: center; }
.teacher-wrap .maestra-bubble { top: calc(100% + 10px); right: -4px; width: max-content; max-width: 13.5rem; }
/* sin la bolita verde (se leía como "en línea"): el globito ya dice para qué es su carita */
.lesson-top .teacher-play { display: none; }

/* Sticker de los juegos de Mundo Chiquito. Puerto fiel de "Achievement Unlocked" (21st.dev, trophyso, id 13045)
   con su "Achievement badge" (id 12996) en tamaño xl: fondo oscuro al 80%, tarjeta centrada max-w-md con
   p-6 y sombra 2xl, cerrar arriba a la derecha, insignia de 112px (mt-8 mb-12), píldora, título 4xl, texto lg
   y botones mt-8. Cambia: la insignia es Patitas, la píldora dice "Sticker nuevo" y los colores son del kit. */
.sticker { position: fixed; inset: 0; z-index: 70; }
.sticker-backdrop { position: absolute; inset: 0; background: rgba(42, 33, 24, 0.8); }
.sticker-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 32px);
  max-width: 448px;
  padding: 24px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.sticker-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.sticker-close:hover { background: var(--muted); }
.sticker-close svg { width: 16px; height: 16px; }
.sticker-content { display: flex; flex-direction: column; align-items: center; text-align: center; }
.sticker-badge {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin: 32px 0 48px;
  border-radius: 999px;
  background: var(--muted);
}
.sticker-badge .pat { width: 96px; height: 96px; }
.sticker-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 700;
}
.sticker-pill svg { width: 16px; height: 16px; color: var(--gold); }
.sticker h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.sticker-desc { margin: 0 0 12px; font-size: 1.125rem; color: var(--ink-soft); }
.sticker-actions { display: flex; gap: 12px; margin-top: 32px; }

/* En un juego no hay velocidades ni estrellas por pasos: solo jugar */
body.is-game #star-steps,
body.is-game .seg:has(#btn-speed-lenta),
body.is-game #btn-memory,
body.is-game #btn-workbook,
body.is-game #btn-metro,
body.is-game #mode-pick { display: none !important; } /* un juego no lleva cuaderno (Yereidys, 2 dic) */

/* Patitas arriba y al centro, en su propia franja del escenario: puerto de "Dynamic Island" (21st.dev,
   educalvolpz, id 12160). Del original: la píldora w-fit con min-width 100px y radio 32px, overflow
   oculto, el ancho que cambia con un resorte (bounce 0.5, 0.25 s) y el contenido nuevo que entra de
   scale 0.9, opacidad 0 y blur 5px (app.js, islandFollowsHint). Cambia: crema con borde de Patitas en vez
   de negro, su cara a la izquierda y letra grande. La franja es suya: las notas y el piano empiezan
   debajo, así que no tapa nada. */
#view-leccion .stage { --island-h: 78px; }
#view-leccion .stage canvas,
#view-leccion .stage .hand3d-layer { top: var(--island-h); height: calc(100% - var(--island-h)); }
#view-leccion .stage .pat-hint {
  position: absolute;
  top: calc(var(--island-h) / 2);
  left: 12px;
  right: 12px;
  z-index: 3;
  transform: translateY(-50%);
  width: fit-content;
  min-width: 100px;
  max-width: calc(100% - 24px);
  margin: 0 auto; /* left + right + auto: centrado con todo el ancho para crecer */
  padding: 4px 18px 4px 4px;
  gap: 12px;
  overflow: hidden;
  border: 3px solid #4a2a5e;
  border-radius: 32px;
  background: var(--card);
  font-size: 1.15rem;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  pointer-events: none;
}
#view-leccion .stage .pat-hint #hint {
  display: -webkit-box;
  -webkit-line-clamp: 3; /* 2 cortaba la instrucción del juego (revisión 100x r3) */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#view-leccion .stage .pat-hint-face { width: 2.8em; height: 2.8em; flex: 0 0 auto; }
@media (max-width: 620px) {
  #view-leccion .stage { --island-h: 70px; }
  #view-leccion .stage .pat-hint { font-size: 0.95rem; line-height: 1.15; }
  #view-leccion .stage .pat-hint-face { width: 2.6em; height: 2.6em; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #view-leccion .stage { --island-h: 58px; }
  #view-leccion .stage .pat-hint { font-size: 0.95rem; padding: 3px 14px 3px 3px; border-width: 2px; }
  #view-leccion .stage .pat-hint-face { width: 2.4em; height: 2.4em; }
}
/* iPad y pantallas grandes: la isla más grande, que se vea desde lejos */
@media (min-width: 900px) and (min-height: 521px) {
  #view-leccion .stage { --island-h: 92px; }
  #view-leccion .stage .pat-hint { font-size: 1.45rem; padding: 5px 24px 5px 5px; }
  #view-leccion .stage .pat-hint-face { width: 2.6em; height: 2.6em; }
}

/* ---------------------------------------------------------------- cómo practicar: un botón y su menú
   Puerto de "Mode Selector" (21st.dev, serafimcloud, id 12357): la píldora lleva ícono, nombre y una
   flechita; el menú abre encima (bottom-full, mb-1.5), radio 10 px, borde fino, sombra, padding 4 px,
   renglones con ícono + nombre y la palomita en el activo. Agrandado a dedo de niño (renglón de 3 rem). */
.mode-pick { position: relative; }
.mode-trigger { gap: 6px; }
.mode-face { display: inline-flex; align-items: center; gap: inherit; min-width: 0; }
.mode-chev { width: 1rem !important; height: 1rem !important; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.6; transition: transform 200ms var(--ease); }
.mode-trigger[aria-expanded='true'] .mode-chev { transform: rotate(180deg); }
.mode-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 50;
  min-width: 15rem;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 18px 40px -18px rgba(30, 24, 16, 0.45);
  display: grid;
  gap: 2px;
  transform-origin: bottom right;
  animation: mode-menu-in 160ms var(--ease);
}
.mode-menu[hidden] { display: none; }
@keyframes mode-menu-in { from { opacity: 0; transform: translateY(6px) scale(0.97); } }
.mode-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 3rem;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
}
.mode-item:hover, .mode-item:focus-visible { background: var(--muted); outline: none; }
.mode-item[aria-pressed='true'] { background: var(--muted); }
.mode-item > svg:first-child { width: 1.4rem; height: 1.4rem; flex: 0 0 auto; }
.mode-name { flex: 1; min-width: 0; }
.mode-check { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; fill: none; stroke: var(--go); stroke-width: 3; visibility: hidden; }
.mode-item[aria-pressed='true'] .mode-check { visibility: visible; }
/* Patitas pide un modo: late el botón (y, abierto el menú, el renglón) */
.mode-pick:has(.mode-item.is-nudge) .mode-trigger { position: relative; overflow: visible; }
.mode-pick:has(.mode-item.is-nudge) .mode-trigger::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 3px solid var(--gold);
  pointer-events: none;
  animation: ring 1.4s var(--ease) infinite;
}
.mode-item.is-nudge { box-shadow: inset 0 0 0 2px var(--gold); }
/* el botón que se acaba de abrir (Rápido, De memoria) entra con un salto */
.is-unlocked { animation: unlock-pop 520ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes unlock-pop { from { transform: scale(0.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .mode-menu, .is-unlocked, .mode-pick:has(.mode-item.is-nudge) .mode-trigger::after { animation: none; }
}
/* en el teléfono los botones van ícono arriba y nombre abajo: el de modo igual, con la flechita al lado */
@media (max-width: 620px) {
  #view-leccion .seg .mode-trigger { flex-direction: row; gap: 4px; }
  #view-leccion .mode-face { flex-direction: column; gap: 2px; }
}

/* ---------------------------------------------------------------- el cuaderno que suena
   Puerto de "Read Along Text" (21st.dev, dhxwhy, id 44846): botón redondo de play, la barrita de
   avance, la nota que suena sube 2 px sobre un resaltado que crece desde la izquierda (220 ms), las
   que faltan tenues mientras suena, y una rayita debajo de la nota (2 px, 4 px de separación). */
.ra-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.ra-play { width: 3.4rem; height: 3.4rem; padding: 0; border-radius: 50%; flex: 0 0 auto; }
.ra-play svg { width: 1.5rem; height: 1.5rem; }
.ra-track { position: relative; flex: 1; height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.ra-fill { position: absolute; inset: 0; background: var(--go); transform: scaleX(0); transform-origin: left; border-radius: inherit; }
.ra-label { flex: 0 0 auto; font-family: var(--display); font-weight: 800; color: var(--ink-soft); font-size: 0.95rem; }
.pill { position: relative; border: 0; font-family: inherit; cursor: pointer; transition: opacity 300ms var(--ease), transform 300ms var(--ease); }
.pill:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sheet-bars[data-stage='reading'] .pill[data-state='upcoming'] { opacity: 0.4; }
.pill::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}
.pill[data-state='current']::after { opacity: 1; transform: scaleX(1); transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms; }
.ra-caret {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--gold-deep);
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms;
}
.ra-caret[data-visible='true'] { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .pill, .pill[data-state='current']::after, .ra-caret { transition: none; }
  .pill[data-state='current'] { transform: none; }
}
/* velocidades del cuaderno: las mismas píldoras de la lección, más chicas */
.ra-speeds { display: flex; width: fit-content; margin: -6px 0 16px; }
.ra-speeds .btn3d { white-space: nowrap; padding: 0 0.75rem; gap: 6px; }
.ra-speeds .btn3d svg { width: 1.1rem; height: 1.1rem; }
/* el número del renglón suena ese renglón: número arriba, play chiquito abajo */
.bar-num {
  flex: 0 0 2.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 0;
  border: 0;
  border-radius: 10px;
  background: var(--muted);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 200ms var(--ease), color 200ms var(--ease);
}
.bar-num svg { width: 0.75rem; height: 0.75rem; fill: currentColor; opacity: 0.7; }
.bar-num:hover, .bar-num:focus-visible { background: #fff3d6; color: var(--gold-deep); outline: none; }
.bar-num.is-playing { background: var(--go); color: #fff; }

/* la nota que suena brilla en su propio color: puerto de "Glow Effect" (21st.dev, ibelick, id 57),
   modo pulse: halo difuminado de su color que respira (opacidad 0.5 → 0.8, escala 1 → 1.1). Hecho
   con sombras afuera de la nota para que el borde redondo no lo recorte. */
.pill[data-state='current'] {
  z-index: 1;
  opacity: 1;
  filter: saturate(1.3) brightness(1.06);
  transform: translateY(-2px) scale(1.04);
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15), 0 0 14px 3px color-mix(in srgb, var(--glow) 70%, transparent), 0 0 34px 10px color-mix(in srgb, var(--glow) 45%, transparent);
  animation: note-glow 0.9s ease-in-out infinite alternate;
}
@keyframes note-glow {
  from { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15), 0 0 14px 4px color-mix(in srgb, var(--glow) 75%, transparent), 0 0 34px 12px color-mix(in srgb, var(--glow) 45%, transparent); }
  to { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15), 0 0 22px 8px var(--glow), 0 0 56px 22px color-mix(in srgb, var(--glow) 70%, transparent); }
}
.ra-sparks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
@media (prefers-reduced-motion: reduce) { .pill[data-state='current'] { animation: none; } }

/* decoración del mapa: la banda de Patitas, instrumentos con su cara junto al camino (ver instrumentSvg
   en app.js). Entran de un saltito y luego cada uno se mueve a su manera, con el compás corrido (--beat). */
.node { position: relative; }
.map-deco {
  position: absolute;
  top: -10px;
  width: 4.6rem;
  pointer-events: none;
  animation: deco-pop 0.55s cubic-bezier(0.3, 1.5, 0.4, 1) var(--delay, 0s) both;
}
.map-deco.is-left { right: calc(100% - 4px); }
.map-deco.is-right { left: calc(100% - 4px); }
.map-deco-svg { display: block; width: 100%; height: auto; overflow: visible; stroke: none; }
.map-deco-svg g, .map-deco-svg path { transform-box: view-box; }
.deco-body { transform-origin: 60px 112px; animation-delay: var(--beat, 0s); }
.deco-bob { animation: deco-bob 3.2s ease-in-out infinite; animation-delay: var(--beat, 0s); }
.deco-sway { animation: deco-sway 3.8s ease-in-out infinite; animation-delay: var(--beat, 0s); }
.deco-shake { animation: deco-shake 3s ease-in-out infinite; animation-delay: var(--beat, 0s); }
.deco-ring { transform-origin: 60px 14px; animation: deco-ring 3.4s ease-in-out infinite; animation-delay: var(--beat, 0s); }
.deco-arm { transform-origin: 60px 70px; animation: deco-tick 0.9s ease-in-out infinite alternate; }
.deco-spark { transform-origin: center; transform-box: fill-box; animation: deco-twinkle 2.4s ease-in-out infinite; animation-delay: var(--beat, 0s); }
@keyframes deco-pop {
  0% { opacity: 0; transform: translateY(14px) scale(0.4); }
  60% { opacity: 1; transform: translateY(-4px) scale(1.08); }
  100% { opacity: 1; transform: none; }
}
@keyframes deco-bob { 50% { transform: translateY(-5px); } }
@keyframes deco-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes deco-shake {
  0%, 62%, 100% { transform: rotate(0); }
  68% { transform: rotate(-12deg); } 74% { transform: rotate(10deg); }
  80% { transform: rotate(-8deg); } 86% { transform: rotate(5deg); }
}
@keyframes deco-ring {
  0%, 60%, 100% { transform: rotate(0); }
  68% { transform: rotate(14deg); } 76% { transform: rotate(-12deg); } 84% { transform: rotate(6deg); }
}
@keyframes deco-tick { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }
@keyframes deco-twinkle { 0%, 100% { transform: scale(0.6); opacity: 0.5; } 50% { transform: scale(1.1); opacity: 1; } }
.level.is-locked .map-deco { filter: grayscale(1); opacity: 0.4; }
.level.is-locked .map-deco * { animation: none; }
@media (min-width: 621px) {
  .map-deco { width: 5.6rem; }
  .map-deco.is-left { right: calc(100% + 18px); }
  .map-deco.is-right { left: calc(100% + 18px); }
}
@media (prefers-reduced-motion: reduce) { .map-deco, .map-deco * { animation: none; } }
/* mientras suena la canción la barra de estrellas se queda en su sitio, solo más tenue */
.star-steps { transition: opacity 250ms var(--ease); }
.star-steps.is-quiet { opacity: 0.45; }

/* ---------------------------------------------------------------- piano libre
   El teclado de la lección a pantalla completa: blancas con la franja de su color y su nombre
   arriba (como en el escenario), negras encima. Ver renderFreePiano en app.js. */
.tabbar { grid-template-columns: repeat(5, 1fr); }
/* sin barra de abajo en el piano libre: el piano llega hasta el borde */
#view-piano:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: 0;
}
.fp-octave { margin-left: auto; display: flex; gap: 8px; }
#view-piano .lesson-top { flex-wrap: nowrap; }
#view-piano .lesson-titles h1 { font-size: clamp(1.2rem, 5vw, 2rem); }
.free-piano {
  position: relative; /* Keys: raíz relativa, teclas absolutas en % */
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  border: 10px solid var(--stage);
  border-radius: 24px;
  background: var(--stage);
  box-shadow: 0 22px 48px -28px rgba(30, 24, 16, 0.6);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
/* del demo de Keys: blancas con borde fino, redondeadas abajo, nombre abajo; negras al 60 % del alto */
.fp-key {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 12px;
  border: 1px solid #d8d0c3;
  border-radius: 0 0 12px 12px;
  background: #fbf8f2;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline-offset: -3px;
  transition: background-color 60ms;
}
.fp-key:focus-visible { outline: 3px solid var(--gold); }
.fp-key[data-black] { bottom: 40%; z-index: 1; border-color: #0d0a08; border-radius: 0 0 9px 9px; background: #1a1410; }
.fp-key[data-white][data-pressed] { background: color-mix(in srgb, var(--key) 38%, #fbf8f2); }
.fp-key[data-black][data-pressed] { background: color-mix(in srgb, var(--key) 70%, #1a1410); }
/* el nombre va abajo, donde las negras no lo tapan, en una bolita de su color */
.fp-name {
  display: grid;
  place-items: center;
  min-width: 2.2em;
  height: 2.2em;
  padding: 0 0.3em;
  border-radius: 999px;
  background: var(--key);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(0.8rem, 2.4vw, 1.2rem);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.fp-tip { margin: 12px 0 0; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; font-weight: 800; color: var(--ink); font-size: 1rem; }
.fp-tip svg { width: 1.5rem; height: 1.5rem; flex: 0 0 auto; color: var(--gold-deep); animation: fp-turn 2.4s ease-in-out infinite; }
@keyframes fp-turn { 0%, 40% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { .fp-tip svg { animation: none; } }
@media (orientation: landscape), (min-width: 700px) { .fp-tip { display: none; } }
.fp-key[data-white] .fp-name { font-size: clamp(0.95rem, 3vw, 1.5rem); }
@media (orientation: landscape) and (max-height: 520px) {
  #view-piano:not([hidden]) { height: calc(100dvh - 24px - env(safe-area-inset-bottom)); }
  #view-piano .lesson-top { margin: 0 0 6px; }
}

/* ---------------------------------------------------------------- la Liga
   Podio: puerto de "Leaderboard Podium" (21st.dev, trophyso, id 13057): orden 2-1-3, avatar de 56px con
   corona abajo a la derecha, nombre y cifra, bloque de 88px de ancho y 128/96/80 de alto con el puesto.
   Tabla: puerto de "Leaderboard Table" (21st.dev, arihantcodes, id 30672), variante panel: medalla de 24px
   con anillo para los tres primeros, avatar de 28px con nombre y subtítulo, cifra y racha a la derecha. */
.liga { display: grid; gap: 16px; }
.liga-head {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  padding: 18px 20px; background: var(--card); border-radius: 24px;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 12px 32px -18px rgba(42, 33, 24, 0.25);
}
.liga-tier { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 1.6rem; line-height: 1.1; color: var(--gold-deep); }
.liga-tier svg { width: 1.5rem; height: 1.5rem; }
.liga-me { grid-column: 1; margin: 0; font-weight: 700; color: var(--ink-soft); }
.liga-me b { color: var(--ink); font-variant-numeric: tabular-nums; }
.liga-left { grid-column: 2; grid-row: 1 / span 2; margin: 0; padding: 6px 12px; border-radius: 999px; background: var(--muted); font-size: 0.84rem; font-weight: 700; }
.liga-loading { margin: 8px 0; text-align: center; font-weight: 700; color: var(--ink-soft); }
.liga-nudge { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 16px; border-radius: 18px; background: #e7f6ec; color: #0d5a22; font-weight: 700; }
.liga-nudge.is-up { background: #fff4d6; color: var(--gold-deep); }
.liga-nudge svg { width: 1.2rem; height: 1.2rem; flex: 0 0 auto; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 16px; padding-top: 8px; }
.podium-spot { display: flex; flex-direction: column; align-items: center; --rank: var(--gold); --rank-ink: var(--gold-deep); }
.podium-2 { --rank: #c9c3b8; --rank-ink: #5f584d; }
.podium-3 { --rank: #e3a46b; --rank-ink: #8a4a14; }
.podium-avatar { position: relative; margin-bottom: 8px; }
.podium-avatar .liga-pat { width: 56px; height: 56px; }
.podium-1 .podium-avatar .liga-pat { width: 72px; height: 72px; }
.podium-crown {
  position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%; background: var(--card); color: var(--rank-ink);
  box-shadow: 0 1px 3px rgba(42, 33, 24, 0.2);
}
.podium-crown svg { width: 16px; height: 16px; }
.podium-name { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: 0.875rem; font-weight: 800; }
.podium-value { font-size: 0.875rem; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.podium-block { width: 88px; margin-top: 8px; border-radius: 14px 14px 0 0; background: color-mix(in srgb, var(--rank) 55%, transparent); }
.podium-1 .podium-block { height: 128px; }
.podium-2 .podium-block { height: 96px; }
.podium-3 .podium-block { height: 80px; }
.podium-block span { display: flex; align-items: center; justify-content: center; height: 32px; font-family: var(--display); font-size: 1.3rem; font-weight: 800; color: var(--rank-ink); }
.podium-spot.is-me .podium-name { color: #0d5a22; }

.liga-table-wrap {
  overflow: hidden; background: var(--card); border-radius: 24px;
  box-shadow: 0 1px 2px rgba(42, 33, 24, 0.06), 0 12px 32px -18px rgba(42, 33, 24, 0.25);
}
.liga-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.liga-table th { padding: 10px 12px; text-align: left; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); background: var(--muted); }
.liga-table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.liga-table .liga-col-rank { width: 56px; text-align: center; }
.liga-table .liga-num { text-align: right; font-variant-numeric: tabular-nums; }
.liga-table tr.is-me td { background: #e7f6ec; }
.liga-medal { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-size: 0.75rem; font-weight: 800; box-shadow: inset 0 0 0 1px currentColor; }
.liga-medal-1 { background: #fff4d6; color: var(--gold-deep); }
.liga-medal-2 { background: #f1eee8; color: #5f584d; }
.liga-medal-3 { background: #fdeee0; color: #8a4a14; }
.liga-rank { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.liga-you { font-size: 0.8rem; font-weight: 800; color: #0d5a22; }
.liga-player { display: flex; align-items: center; gap: 8px; min-width: 0; }
.liga-pat-sm { width: 28px; height: 28px; }
.liga-nick { display: block; max-width: 8rem; overflow: hidden; text-overflow: ellipsis; font-weight: 800; white-space: nowrap; }
.liga-table td, .liga-table th { padding-left: 8px; padding-right: 8px; }
.liga-table .liga-col-rank { width: 40px; }
.liga-sub { display: block; font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); }
.liga-streak { color: #a8440a; white-space: nowrap; }
.liga-streak svg { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.liga-cut td { padding: 6px 12px; border-top: 2px dashed var(--gold); background: transparent; text-align: center; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gold-deep); }

.liga-off { display: grid; justify-items: center; gap: 10px; padding: 24px; text-align: center; }
.liga-off .pat { width: 110px; height: 110px; }
.liga-off h2 { margin: 0; font-family: var(--display); }
.liga-off p { margin: 0; color: var(--ink-soft); font-weight: 600; }
.liga-off .liga-ask { color: var(--ink); font-weight: 800; }

.liga-nick-preview { margin: 6px 0; font-family: var(--display); font-size: 1.4rem; }
.liga-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.liga-chip { padding: 6px 12px; border: 0; border-radius: 999px; background: var(--muted); font: inherit; font-size: 0.86rem; font-weight: 700; color: var(--ink); cursor: pointer; }
.liga-chip.is-on { background: var(--go); color: #fff; }

/* ---------------------------------------------------------------- hoja de Premium
   Puerto de "Smooth Drawer" (21st.dev, kokonutd, id 25000). Medidas del original: hoja p-6 con
   esquinas de 16px y sombra xl, asa de 100x8, contenido de 340px con 24px entre bloques, título 1.5rem,
   precio 2.25rem con el viejo tachado a 1.125rem, botones de 44px con esquinas de 12px. El resorte
   (rigidez 300, amortiguación 30) va como curva; el escalonado: 0.2s y luego 0.07s por pieza. */
.psheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(42, 33, 24, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.psheet-backdrop.is-open { opacity: 1; }
.psheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 91;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 24px calc(24px + env(safe-area-inset-bottom));
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1), 0 -8px 30px rgba(42, 33, 24, 0.12);
  font-family: var(--ui);
  color: var(--ink);
  transform: perspective(900px) translateY(100%) rotateX(5deg);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.22, 1.15, 0.36, 1), opacity 0.3s ease;
}
.psheet.is-open { transform: perspective(900px) translateY(0) rotateX(0); opacity: 1; }
.psheet-handle { width: 100px; height: 8px; margin: 16px auto 0; border-radius: 999px; background: var(--muted); }
.psheet-body { width: min(340px, calc(100vw - 48px)); margin: 0 auto; padding-top: 24px; display: grid; gap: 24px; }
.psheet-item {
  opacity: 0;
  transform: translateY(20px);
  transition: transform 0.5s cubic-bezier(0.22, 1.15, 0.36, 1), opacity 0.35s ease;
  transition-delay: calc(0.2s + var(--i, 0) * 0.07s);
}
.psheet.is-open .psheet-item { opacity: 1; transform: none; }
.psheet-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.psheet-tile {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fffaf1, var(--muted));
  box-shadow: inset 0 2px 4px rgba(42, 33, 24, 0.08);
}
.psheet-tile .pat { position: absolute; inset: 3px; }
.psheet-desc { margin: 0; font-size: 0.95rem; line-height: 1.6; color: var(--ink-soft); }
.psheet-price { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 0 auto; }
.psheet-amount { display: flex; align-items: baseline; gap: 8px; }
.psheet-amount b {
  font-family: var(--display);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--ink), #5a4a38);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.psheet-amount s { font-size: 1.125rem; color: #a8987f; }
.psheet-note { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.psheet-note span { font-size: 0.875rem; font-weight: 700; }
.psheet-note small { font-size: 0.75rem; color: var(--ink-soft); }
.psheet-actions { display: grid; gap: 12px; }
.psheet-primary,
.psheet-secondary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  overflow: hidden;
  border-radius: 12px;
  font: 700 0.95rem/1 var(--ui);
  text-decoration: none;
  cursor: pointer;
}
.psheet-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(90deg, var(--go), var(--go-hover));
  box-shadow: 0 10px 15px -3px rgba(19, 147, 55, 0.22);
  transition: box-shadow 0.5s ease, filter 0.5s ease;
}
.psheet-primary:hover { box-shadow: 0 20px 25px -5px rgba(19, 147, 55, 0.32); filter: brightness(1.05); }
.psheet-primary[disabled] { cursor: default; filter: saturate(0.6); opacity: 0.85; }
.psheet-shine {
  position: absolute;
  inset: 0;
  transform: translateX(-200%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}
.psheet-primary:not([disabled]):hover .psheet-shine { animation: psheet-shine 1.5s ease-in-out; }
.psheet-label { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.psheet-wiggle { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; animation: psheet-wiggle 3s ease-in-out infinite; }
.psheet-secondary { border: 1px solid var(--line); background: var(--card); color: var(--ink); transition: background 0.2s ease; }
.psheet-secondary:hover { background: var(--muted); }
@keyframes psheet-shine { from { transform: translateX(-200%); } to { transform: translateX(200%); } }
@keyframes psheet-wiggle {
  0%, 66.6%, 100% { transform: none; }
  16.6% { transform: rotate(15deg) translateY(-2px); }
  33.3% { transform: rotate(-15deg) translateY(2px); }
}
@media (prefers-reduced-motion: reduce) {
  .psheet, .psheet-item, .psheet-backdrop { transition: opacity 0.2s ease; transform: none; }
  .psheet-wiggle, .psheet-primary:hover .psheet-shine { animation: none; }
}
.node-btn.is-premium { color: var(--gold-deep); }

/* el botón de salir de Instagram/TikTok es un enlace: sin subrayado */
a.btn3d { text-decoration: none; }

/* sin internet: empty8 (bundui, 21st.dev) a pantalla completa con los colores de la app */
.offline { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.offline[hidden] { display: none; }
.offline-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; text-align: center; text-wrap: balance; }
.offline-header { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 24rem; }
.offline-media { width: 120px; height: 120px; object-fit: contain; margin-bottom: 8px; }
.offline-title { font-size: 1.5rem; color: var(--ink); }
.offline-desc { margin: 0; color: var(--ink-soft); font-size: 1rem; line-height: 1.6; }
.offline-content { display: flex; justify-content: center; gap: 8px; width: 100%; max-width: 24rem; }
.offline-content .btn3d { width: 100%; max-width: 20rem; }

/* La vida de Patitas: misma hoja que Premium, Patitas grande arriba */
.patlife-stage { display: grid; place-items: center; }
.patlife-stage .pat { position: relative; width: 180px; height: 180px; cursor: pointer; }
.patlife[data-life='sad'] .patlife-stage .pat { filter: saturate(0.55) brightness(0.92); }
.patlife-title { justify-content: center; }
.patlife-say { text-align: center; }
.patlife-meters { display: grid; gap: 14px; }
.patlife-meters .rank-bar { margin-top: 6px; }
.patlife-row { display: flex; justify-content: space-between; font-size: 0.875rem; }
.patlife-row span { color: var(--ink-soft); font-weight: 700; }
.patlife[data-life='sad'] .patlife-fill-hp, .patlife[data-life='idle'] .patlife-fill-hp { background: #e5484d; }
.patlife[data-life='happy'] .patlife-fill-hp, .patlife[data-life='celebrate'] .patlife-fill-hp { background: #2fb350; }

/* Canciones a dos manos en teléfono vertical: no se puede tocar hasta girarlo */
.rotate-gate { display: none; }
@media (max-width: 620px) and (orientation: portrait) and (pointer: coarse) {
  body.two-hands #view-leccion .rotate-gate {
    position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: 16px;
    padding: 32px; text-align: center; background: var(--bg, #fdf6ea); color: var(--ink);
  }
  body.two-hands #view-leccion .rotate-tip { display: none; }
  .rotate-gate .pat { position: relative; width: 140px; height: 140px; }
  .rotate-gate svg { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 2; animation: tip-turn 2.4s var(--ease) infinite; }
  .rotate-gate p { margin: 0; font-size: 1.25rem; line-height: 1.4; }
  .rotate-gate small { color: var(--ink-soft); }
}

/* Atrapa la nota: su lienzo tapa el escenario; Patitas (arriba) sigue a la vista */
.stage { position: relative; }
.ritmo { position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; }
.ritmo > .ritmo-results { pointer-events: auto; }
.ritmo-replay { position: absolute; right: 8px; top: calc(var(--island-h, 78px) + 8px); /* arriba a la derecha: a la izquierda tapaba las notas del Do (revisión 100x r3) */ pointer-events: auto; border: 0; border-radius: 999px; padding: 6px 12px; background: rgba(255,255,255,.9); color: #3a2f48; font: 800 .8rem Nunito, system-ui, sans-serif; box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: pointer; }
.ritmo-replay[hidden] { display: none; }
.console > .ritmo-replay { position: static; display: inline-flex; align-items: center; gap: 6px; padding: 0 18px; min-height: 56px; font-size: 1rem; background: var(--card); color: var(--ink); }
.console > .ritmo-replay svg { width: 18px; height: 18px; }
/* puntitos de progreso: verde atrapada, rojo fallada */
.ritmo-dots { position: absolute; top: 88px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-width: 86%; padding: 6px 10px; border-radius: 999px; background: rgba(20,16,12,.45); }
.ritmo-dots i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255,255,255,.3); transition: background .2s, transform .2s; }
.ritmo-dots i.is-good { background: #46b85a; transform: scale(1.2); }
.ritmo-dots i.is-bad { background: #ff4d4f; }
/* resultados */
.ritmo-results { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(26,20,36,.72); z-index: 3; }
.ritmo-card { background: var(--card); color: var(--ink); border-radius: 26px; padding: 22px 30px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: ritmo-pop .35s ease-out; }
.ritmo-stars { font-size: 3rem; letter-spacing: 6px; }
.ritmo-stars span { color: #e2d9cb; }
.ritmo-stars span.on { color: #f2c230; text-shadow: 0 2px 0 #c99a12; }
.ritmo-score { margin: 6px 0 2px; font: 800 1.4rem Nunito, system-ui, sans-serif; }
.ritmo-sub { margin: 0 0 14px; color: var(--ink-soft); font-weight: 700; }
.ritmo-go { border: 0; border-radius: 16px; padding: 12px 28px; background: #46b85a; color: #fff; font: 900 1.2rem Nunito, system-ui, sans-serif; box-shadow: 0 5px 0 #2f8a3f; cursor: pointer; }
@keyframes ritmo-pop { from { transform: scale(.85); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ritmo-card { animation: none; } }
.stage .pat-hint { z-index: 3; }

/* Quizzes entre canciones (quiz.js): ¿Qué nota es? y Marca el dedo. Usa las tarjetas de la app. */
.quiz { position: absolute; inset: 0 0 auto 0; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 96px 14px 14px; pointer-events: none; } /* arriba vive el globo de Patitas */
.quiz > * { pointer-events: auto; }
.quiz[data-mode] { inset: 0; background: var(--bg); border-radius: inherit; }
.quiz-ask { display: none; margin: 0; font-weight: 800; font-size: 1.25rem; color: var(--ink); background: var(--card); padding: 6px 16px; border-radius: 999px; }
.quiz-card { background: var(--card); border-radius: 18px; padding: 6px 12px; color: var(--ink); box-shadow: 0 4px 14px rgba(42,33,24,.12); }
.quiz-staff { display: block; width: min(300px, 70vw); height: auto; }
.quiz-hand { position: relative; width: min(340px, 70%, 52vh); flex: 0 1 auto; }
.quiz-hand img { display: block; width: 100%; height: auto; }
.quiz-tip { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 3px dashed transparent; background: transparent; cursor: pointer; }
.quiz[data-mode="tip"] .quiz-tip { border-color: rgba(42,33,24,.35); }
.quiz[data-mode="num"] .quiz-tip, .quiz[data-mode="tip"] .quiz-nums { display: none; }
.quiz-nums { display: flex; gap: 10px; }
.quiz-num { width: 54px; height: 54px; border-radius: 16px; border: 0; background: var(--card); color: var(--ink); font: 800 1.5rem Nunito, system-ui, sans-serif; box-shadow: 0 3px 0 rgba(42,33,24,.18); cursor: pointer; }
.quiz .is-hint { animation: quiz-hint .5s ease-in-out 3 alternate; border-color: #f2c230; background: #f2c23055; }
@keyframes quiz-hint { to { transform: scale(1.15); } }
.quiz[data-mode="full"] { justify-content: center; }
.quiz-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.quiz-big { width: 130px; height: 130px; border: 0; border-radius: 28px; background: var(--card); color: var(--ink); font: 900 3.4rem/1 Nunito, system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 5px 0 rgba(42,33,24,.18); cursor: pointer; }
.quiz-big span { font-size: 1.1rem; font-weight: 800; }
.quiz-again { border: 0; background: transparent; color: var(--ink-soft); font: 800 1rem Nunito, system-ui, sans-serif; text-decoration: underline; cursor: pointer; }
.quiz-drum { width: min(240px, 55vw); aspect-ratio: 1; border-radius: 50%; border: 10px solid #c0763a; background: radial-gradient(circle at 50% 40%, #fff, #f3e3c8); color: var(--ink-soft); font: 800 1.2rem Nunito, system-ui, sans-serif; box-shadow: 0 8px 0 #8a4f22; touch-action: manipulation; cursor: pointer; }
.quiz-drum:active { transform: translateY(5px); box-shadow: 0 3px 0 #8a4f22; }
.quiz-dots { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.quiz-dot { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--card); color: var(--ink); font: 900 1.6rem Nunito, system-ui, sans-serif; box-shadow: 0 4px 0 rgba(42,33,24,.18); cursor: pointer; }
.quiz-slots { display: flex; gap: 8px; }
.quiz-slot { width: 84px; height: 64px; border-radius: 16px; border: 3px dashed rgba(42,33,24,.25); display: grid; place-items: center; }
.quiz-piece { min-width: 78px; height: 56px; border: 0; border-radius: 14px; background: var(--c); color: #fff; font: 900 1.2rem Nunito, system-ui, sans-serif; box-shadow: 0 4px 0 rgba(0,0,0,.2); cursor: pointer; }
.quiz-slot .quiz-piece { box-shadow: none; min-width: 72px; height: 52px; }

.ritmo-how { width: min(92vw, 380px); padding: 18px 16px 20px; }
.ritmo-demo { margin: 6px 0 14px; }
.ritmo-demo video, .ritmo-demo canvas { display: block; width: 100%; height: auto; }
/* la regla del lienzo del piano (.stage canvas: absoluto y a todo lo alto) estiraba la demo encima del
   botón "¡A jugar!" y el juego parecía congelado (Yereidys, 2 dic) */
#view-leccion .stage .ritmo-demo canvas { position: static; inset: auto; top: auto; height: auto; }
.ritmo-how { max-height: calc(100% - 16px); overflow-y: auto; }
.ritmo-demo video { aspect-ratio: 900 / 446; /* arriba queda aire: lo más alto de Patitas en la vuelta es y=94 de 520 (2 dic) */ object-fit: cover; object-position: 50% 100%; margin-bottom: -4%; }
.ritmo-how .ritmo-go { display: block; margin: 0 auto; }

.how-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.how-dots i { width: 8px; height: 8px; border-radius: 50%; background: #e2d9cb; }
.how-dots i.on { background: #46b85a; width: 22px; border-radius: 999px; }
.how-pat { display: block; width: 110px; height: 110px; margin: 0 auto 4px; }
.how-big { text-align: center; font-size: 1.2rem; margin: 6px 0 16px; }
.how-list { list-style: none; margin: 8px 0 16px; padding: 0; font-size: 1.05rem; line-height: 1.35; }
.how-list li { display: flex; gap: 10px; align-items: center; margin: 10px 0; text-align: left; }
.how-list li p { margin: 0; flex: 1; }
.how-list span { flex: 0 0 34px; height: 34px; border-radius: 50%; background: #fff3d6; display: grid; place-items: center; color: #3a2f48; }
.how-list span svg { width: 20px; height: 20px; }
.how-nav { display: flex; justify-content: center; gap: 10px; }
.how-nav .ritmo-go { margin: 0; }
.how-back { border: 0; background: none; color: #7a6f86; font: 800 1rem Nunito, system-ui, sans-serif; padding: 10px 14px; cursor: pointer; }
.how-back.btn3d { height: auto; min-height: 2.9rem; color: var(--ink); } /* se veía apagado (revisión 100x r4) */

.how-sub { text-align: center; color: #6b5f78; margin: -8px 0 14px; }
.how-overlay { z-index: 5; }
/* la tarjeta de Patitas cabe en cualquier teléfono (revisión 100x, 2 dic): empieza debajo del globo de
   Patitas, se desliza por dentro si no cabe y el botón de seguir queda siempre pegado abajo, a la vista */
#view-leccion .stage .ritmo-results { top: var(--island-h); }
.ritmo-how { max-height: calc(100% - 12px); overflow-y: auto; overscroll-behavior: contain; }
.ritmo-how .how-nav { position: sticky; bottom: -20px; z-index: 1; margin: 4px -16px -20px; padding: 10px 16px 16px; background: var(--card); }
@media (max-height: 760px) { .how-pat { width: 76px; height: 76px; } .how-list li { margin: 6px 0; } }
/* la demo se achica para caber entera con el botón: la tarjeta mide lo que deja el escenario.
   Lo fijo (puntitos, título, botón, rellenos) ronda 150px; la demo mide 0.84 de su ancho de alto. */
.how-overlay, .ritmo > .ritmo-results { container-type: size; }
.ritmo-how .ritmo-demo { width: min(100%, calc((100cqh - 180px) / 0.84)); margin-inline: auto; }
/* pantallas bajitas: el escenario no da (en 320x568 mide ~200px), así que la tarjeta de Patitas sale a
   pantalla completa, como la de celebrar; el globo repite lo mismo que el título, no se pierde nada */
@media (max-height: 700px) {
  #view-leccion .stage .how-overlay,
  #view-leccion .stage .ritmo > .ritmo-results:has(.ritmo-how) { position: fixed; inset: 0; top: 0; z-index: 60; }
  #view-leccion .stage:has(.ritmo-how) .pat-hint { visibility: hidden; } /* quedaba encima de la tarjeta */
}
/* escenario bajito (iPhone SE, horizontal): Patitas y el pianito lado a lado, así los dos se ven grandes */
@container (max-height: 440px) {
  .ritmo-how .ritmo-demo { width: 100%; display: flex; align-items: flex-end; gap: 8px; }
  .ritmo-how .ritmo-demo > * { flex: 1 1 0; min-width: 0; }
  .ritmo-how .ritmo-demo video { margin-bottom: 0; }
}
.stage > .how-replay { z-index: 4; left: auto; right: 10px; } /* a la derecha: a la izquierda tapaba la columna del Do */

/* revisión 100x r4 */
#install-how { height: 2.75rem; } /* 44px para el dedo */
body.is-playing .stage > .how-replay { display: none; } /* tapaba "¡Déjala pegada!" mientras suena */
.ritmo.is-counting .ritmo-dots { visibility: hidden; } /* que se vea el 3-2-1 */
@media (max-height: 700px) { body:not(.rotate-tip-off) #view-leccion .rotate-tip { display: none; } } /* en teléfonos bajitos el aviso empujaba el botón Tocar fuera de la pantalla */

/* Destreza rítmica (destreza.js, Yereidys 4 dic): pista oscura como Atrapa la nota, botón grande debajo */
.hand-section.is-ritmo { background: #d6f1f4; color: #0d6772; }
.dz { justify-content: center; gap: 18px; }
.dz-count { height: 64px; font: 800 3.4rem/64px var(--display); color: var(--sol); opacity: 0; transform: scale(.7); transition: opacity .12s, transform .12s; }
.dz-count.is-on { opacity: 1; transform: scale(1); }
.dz-lane { position: relative; flex: 0 0 auto; width: min(560px, 94%); height: 96px; border-radius: 20px; background: #1a1424; overflow: hidden; box-shadow: inset 0 -4px 0 rgba(0,0,0,.35); }
.dz-track { position: absolute; inset: 0; will-change: transform; }
.dz-line { position: absolute; top: 8px; bottom: 8px; left: 18%; width: 4px; margin-left: -2px; border-radius: 2px; background: #fff; box-shadow: 0 0 10px rgba(255,255,255,.7); }
.dz-tick { position: absolute; bottom: 8px; width: 2px; height: 12px; margin-left: -1px; background: rgba(255,255,255,.25); }
.dz-tick.is-bar { height: 22px; background: rgba(255,255,255,.55); }
.dz-note { position: absolute; top: 24px; height: 44px; border-radius: 12px; background: linear-gradient(90deg, #fff6 var(--fill, 0%), transparent var(--fill, 0%)), var(--do); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); display: flex; align-items: center; padding-left: 10px; }
.dz-note.is-long { background: linear-gradient(90deg, #fff8 var(--fill, 0%), transparent var(--fill, 0%)), var(--sol); }
.dz-note.is-long { justify-content: center; padding-left: 0; } /* el "mantén" en el centro: pegado a la orilla se cortaba al pasar la línea */
.dz-note em { font: italic 800 .85rem var(--ui); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); pointer-events: none; }
.dz-note.is-good { outline: 3px solid #7ef0a0; }
.dz-note.is-bad { background: #6b6378; }
.dz-pad { flex: 0 1 auto; width: min(220px, 52vw, 30vh); aspect-ratio: 1; border-radius: 50%; border: 0; background: radial-gradient(circle at 50% 38%, #ff5a72, var(--do)); color: #fff; font: 800 1.2rem var(--ui); box-shadow: 0 10px 0 #9c1029, 0 14px 24px rgba(0,0,0,.18); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; transition: transform .06s, box-shadow .06s; }
.dz-pad.is-down { transform: translateY(7px); box-shadow: 0 3px 0 #9c1029, 0 6px 12px rgba(0,0,0,.18); }
.dz-pad.is-bad { animation: dz-shake .3s; }
.dz.is-demo .dz-pad { pointer-events: none; opacity: .85; }
.dz-dots { display: flex; gap: 8px; }
.dz-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dz-dots i.is-good { background: var(--go); }
@keyframes dz-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .dz-pad.is-bad { animation: none; } }
body.is-pulso #view-leccion .rotate-tip { display: none !important; } /* el aviso habla del piano: aquí no hay */
body.is-pulso #stage-canvas { visibility: hidden; } /* sin piano detrás de los juegos de ritmo: se veía alrededor de la tarjeta (revisión 100x) */
/* teléfonos medianos (iPhone SE, 667 de alto): un paso intermedio, si no el botón se salía del escenario (revisión 100x) */
@media (min-height: 641px) and (max-height: 760px) {
  .dz { padding-top: 86px; gap: 10px; justify-content: flex-start; }
  .dz-count { height: 48px; font-size: 2.6rem; line-height: 48px; }
  .dz-lane { height: 84px; }
  .dz-note { top: 20px; height: 40px; }
  .dz-pad { width: min(160px, 42vw, 22vh); }
}
/* teléfonos bajitos y acostados: todo más compacto y el botón más chico, así cuenta, pista y botón caben sin taparse (revisión 100x) */
@media (max-height: 640px) {
  .dz { padding-top: 78px; gap: 6px; justify-content: flex-start; }
  .dz-count { height: 36px; font-size: 2rem; line-height: 36px; }
  .dz-lane { height: 72px; }
  .dz-note { top: 16px; height: 34px; }
  .dz-pad { width: min(110px, 40vw, 26vh); font-size: .95rem; }
}

/* Tarjetas animadas (how-scenes.js). Forma de 21st.dev "Onboarding Dialog" (id 10480): dibujo grande arriba, una línea abajo */
.how-scene { width: 100%; aspect-ratio: 340 / 200; max-height: 34vh; margin: 2px auto 8px; border-radius: 18px; background: #fff7e8; overflow: hidden; }
.ritmo-how.has-scene .ritmo-score { margin-top: 2px; }
.how-line { margin: 2px 0 14px; font-size: 1.05rem; line-height: 1.3; color: var(--ink-soft); }
.how-fade { animation: how-fade .24s ease-out; }
@keyframes how-fade { from { opacity: 0; } to { opacity: 1; } }
.how-dots i { transition: width .22s ease-out, background-color .22s ease-out, opacity .22s ease-out; opacity: .5; }
.how-dots i.on { opacity: 1; }
.sc { display: block; width: 100%; height: 100%; fill: none; stroke: none; font-family: Nunito, system-ui, sans-serif; }
.sc svg, .sc text { stroke: none; } /* la regla global de svg le ponía borde oscuro a la pista y al "mantén" (Miguel: nada de texto negro) */
.sc-line, .sc-ledger { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.sc-line.is-on { stroke: var(--sol); stroke-width: 5; }
.sc-space { fill: rgba(25, 181, 200, .22); }
.sc-num { fill: var(--ink); font-size: 18px; font-weight: 800; }
.sc-clef.sc-clef-big { font-size: 150px; }
.sc-tag { fill: #0d6772; font-size: 18px; font-weight: 800; }
.sc-head { fill: none; stroke: var(--ink); stroke-width: 4; }
.sc-head.is-fill { stroke-width: 2; }
.sc-clef { fill: var(--gold); font-size: 96px; }
.sc-clef.is-glow { filter: drop-shadow(0 0 6px rgba(242, 182, 50, .9)); }
.sc-clef-sm { fill: var(--ink); }
.sc-key rect { fill: #fff; stroke: #cfc3b0; stroke-width: 1.5; transition: fill .2s; }
.sc-key text { fill: #b3a690; font-size: 11px; font-weight: 800; }
.sc-key.is-lit rect { fill: var(--c); stroke: rgba(0, 0, 0, .15); }
.sc-key.is-lit text { fill: #fff; }
.sc-key.is-down rect { transform: translateY(3px); }
.sc-ripple { fill: none; stroke: var(--go); stroke-width: 3; }
.sc-check { fill: none; stroke: var(--go); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.sc-finger rect { fill: #f2c8a0; stroke: #c99a70; stroke-width: 1.5; }
.sc-nail { fill: #fbe3cf; }
.sc-metro { fill: var(--sol); }
.sc-count { fill: var(--sol); font: 800 32px 'Baloo 2', Nunito, sans-serif; }
.sc-lane { fill: #1a1424; }
.sc-bar { fill: var(--do); }
.sc-bar.is-long { fill: var(--sol); }
.sc-bar.is-done { opacity: .55; }
.sc-fill { fill: rgba(255, 255, 255, .55); }
.sc-manten { fill: #fff; font-size: 12px; font-weight: 800; font-style: italic; }
.sc-hit { fill: #fff; }
.sc-pad { fill: var(--do); stroke: #9c1029; stroke-width: 0; filter: drop-shadow(0 6px 0 #9c1029); transition: transform .06s; transform-origin: 170px 164px; }
.sc-pad.is-down { transform: translateY(5px); filter: drop-shadow(0 1px 0 #9c1029); }
@media (max-height: 640px) { .how-scene { max-height: 30vh; } .how-line { margin-bottom: 10px; font-size: 1rem; } }
body:has(.how-overlay) #view-leccion .rotate-tip { display: none !important; } /* la tarjeta de Patitas va sola (revisión 100x) */
.how-overlay .ritmo-go:focus { outline: none; }
.how-overlay .ritmo-go:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; } /* el anillo azul del navegador salía al tocar */
.dz-dots i { width: 14px; height: 14px; background: #d8c9ae; box-shadow: inset 0 0 0 2px #b9a582; } /* se veían como una mancha */

/* cuenta (correo + código): mismos campos que el resto, el código en grande y espaciado */
.account-form { display: grid; gap: 12px; width: 100%; }
.account-form .big-input { width: 100%; text-align: center; }
.account-code { font-size: 1.9rem; font-weight: 800; letter-spacing: 0.45em; font-variant-numeric: tabular-nums; }
#onboard-signin { margin-top: 18px; }
.lesson-signin { margin-left: auto; white-space: nowrap; }
.account-resend { justify-self: center; }

/* ================================================================ cuenta familiar (familia-ui.js)
   Portado de 21st.dev: Sign Up Flow (romanvasnev), Profile Selector (ravikatiyar162), Avatar Picker (kokonutd).
   Mismas medidas y animaciones del original; colores y letra de Do Piano. */
.fx-overlay {
  --fx-fill: #f3ece0; --fx-fill2: #faf5ec; --fx-sep: #efe3cf; --fx-red: #e8213f;
  --fx-ease: cubic-bezier(.2,.9,.25,1); --fx-spring: cubic-bezier(.34,1.56,.64,1);
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: var(--bg); opacity: 0; transition: opacity .3s ease; overflow-y: auto;
  font-family: var(--ui); color: var(--ink); -webkit-font-smoothing: antialiased;
}
.fx-overlay.is-open { opacity: 1; }
.fx-overlay.fx-addkid { background: rgba(255, 248, 236, .85); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes fx-next { from { opacity: 0; transform: translateX(28px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes fx-prev { from { opacity: 0; transform: translateX(-28px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes fx-pop { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes fx-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes fx-spin { to { transform: rotate(360deg); } }
@keyframes fx-draw { to { stroke-dashoffset: 0; } }
@keyframes fx-ring { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes fx-blink { 50% { opacity: 0; } }
@keyframes fx-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* 1. tarjeta de entrar */
.fx-card { width: 100%; max-width: 400px; overflow: hidden; border-radius: 24px; background: #fff;
  box-shadow: 0 0 0 .5px rgba(0,0,0,.05), 0 20px 50px rgba(42,33,24,.12); transition: height .45s var(--fx-ease); }
.fx-inner { padding: 24px; }
.fx-step.fx-next { animation: fx-next .45s var(--fx-ease); }
.fx-step.fx-prev { animation: fx-prev .45s var(--fx-ease); }
.fx-logo { display: flex; align-items: center; gap: 8px; height: 40px; margin-bottom: 22px; font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.fx-logo img { width: 40px; height: 40px; object-fit: contain; }
.fx-head { margin-bottom: 24px; }
.fx-title { margin: 0; font-family: var(--display); font-size: 28px; line-height: 34px; font-weight: 800; letter-spacing: -.01em; }
.fx-sub { margin: 8px 0 0; font-size: 15px; line-height: 21px; color: var(--ink-soft); }
.fx-sub b { color: var(--ink); }
.fx-field { display: flex; align-items: center; height: 50px; border-radius: 12px; background: var(--fx-fill); box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow .2s; }
.fx-field.is-focus { box-shadow: inset 0 0 0 1.5px var(--go); }
.fx-field.is-error { box-shadow: inset 0 0 0 1.5px var(--fx-red); }
.fx-input { width: 100%; height: 100%; padding: 0 16px; border: 0; background: transparent; font: inherit; font-size: 17px; color: var(--ink); outline: none; }
.fx-input::placeholder { color: rgba(107,93,76,.5); }
.fx-error { display: flex; align-items: flex-start; gap: 6px; margin: 8px 0 0; font-size: 13px; line-height: 18px; color: var(--fx-red); animation: fx-in .25s ease; }
.fx-error[hidden] { display: none; }
.fx-error svg { flex-shrink: 0; margin-top: 1.5px; }
.fx-ok { margin: 8px 0 0; font-size: 13px; color: var(--go); animation: fx-in .25s ease; }
.fx-gap { margin-top: 20px; }
.fx-btn { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 50px; border: 0; border-radius: 12px;
  background: var(--go); color: #fff; font: inherit; font-size: 17px; font-weight: 800; cursor: pointer; box-shadow: var(--bevel-dark);
  transition: transform .2s, background-color .2s, opacity .2s; }
.fx-btn:active:not(:disabled) { transform: scale(.98); box-shadow: var(--pressed-dark); }
.fx-btn:disabled { background: var(--fx-fill); color: rgba(107,93,76,.45); box-shadow: none; cursor: default; }
.fx-btn.is-loading { background: var(--go); }
.fx-btn-label { transition: opacity .2s; }
.fx-btn-spin { position: absolute; inset: 0; display: none; place-items: center; }
.fx-btn.is-loading .fx-btn-label { opacity: 0; }
.fx-btn.is-loading .fx-btn-spin { display: grid; }
.fx-spin { animation: fx-spin .8s linear infinite; }
.fx-foot { margin: 20px 0 0; text-align: center; font-size: 15px; color: var(--ink-soft); }
.fx-fine { margin: 12px 0 0; text-align: center; font-size: 12.5px; line-height: 17px; color: rgba(107,93,76,.75); }
.fx-inline, .fx-link, .fx-back, .fx-resend { border: 0; background: none; padding: 0; font: inherit; font-weight: 800; color: var(--go); cursor: pointer; }
.fx-link { display: block; margin: 14px auto 0; font-size: 15px; }
.fx-link[hidden] { display: none; }
.fx-backrow { display: flex; align-items: center; height: 32px; margin-bottom: 20px; }
.fx-back { display: flex; align-items: center; gap: 2px; margin-left: -6px; font-size: 17px; }
/* el código: 6 cajitas, un input invisible encima (pegar y autollenar de iPhone funcionan) */
.fx-code { position: relative; }
.fx-code-input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; opacity: 0; cursor: text; font-size: 16px; }
.fx-boxes { display: flex; justify-content: space-between; gap: 8px; }
.fx-box { position: relative; display: grid; place-items: center; flex: 1; height: 58px; border-radius: 12px; background: var(--fx-fill);
  font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow .2s; }
.fx-box.is-active { box-shadow: inset 0 0 0 1.5px var(--go); }
.fx-box.is-error { color: var(--fx-red); box-shadow: inset 0 0 0 1.5px var(--fx-red); }
.fx-digit { animation: fx-pop .3s var(--fx-ease); }
.fx-caret { width: 2px; height: 28px; border-radius: 2px; background: var(--go); animation: fx-blink 1s steps(1) infinite; }
.fx-dash { width: 12px; height: 3px; border-radius: 2px; background: rgba(107,93,76,.3); }
.fx-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 15px; }
.fx-resend { font-variant-numeric: tabular-nums; }
.fx-resend:disabled { color: rgba(107,93,76,.45); cursor: default; }
.fx-tips { margin-top: 16px; padding: 4px; border-radius: 12px; background: var(--fx-fill2); animation: fx-in .3s ease; }
.fx-tips[hidden] { display: none; }
.fx-tip { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; font-size: 15px; line-height: 20px; }
.fx-tip + .fx-tip { border-top: .5px solid var(--fx-sep); }
.fx-tip-n { display: grid; place-items: center; flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: rgba(19,147,55,.13); color: var(--go); font-size: 12px; font-weight: 800; }
.fx-done { display: flex; flex-direction: column; align-items: center; padding: 16px 0 4px; text-align: center; }
.fx-done .fx-sub { max-width: 290px; }
.fx-full { width: 100%; margin-top: 28px; }
.fx-ring { display: grid; place-items: center; width: 76px; height: 76px; margin-bottom: 20px; border-radius: 50%; background: rgba(19,147,55,.14); animation: fx-ring .5s var(--fx-ease); }
.fx-ring-dot { fill: var(--go); transform-origin: 26px 26px; animation: fx-ring .45s var(--fx-spring) .05s both; }
.fx-check { stroke: #fff; stroke-width: 4.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: fx-draw .45s var(--fx-ease) .35s forwards; }

/* caras de Patitas (perfiles) */
.fx-face { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--face); overflow: hidden; }
.fx-face img { width: 88%; height: 88%; object-fit: contain; margin-top: 10%; }

/* 2. ¿Quién va a tocar? */
.fx-pick { display: flex; flex-direction: column; align-items: center; }
.fx-pick-title { margin: 0 0 40px; font-family: var(--display); font-size: 1.9rem; font-weight: 800; text-align: center; }
.fx-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
@media (min-width: 560px) { .fx-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; } .fx-pick-title { font-size: 3rem; } }
.fx-tile { display: flex; flex-direction: column; align-items: center; gap: 12px; animation: fx-up .45s var(--fx-ease) both; }
.fx-tile:nth-child(2) { animation-delay: .06s; } .fx-tile:nth-child(3) { animation-delay: .12s; } .fx-tile:nth-child(4) { animation-delay: .18s; }
.fx-tile:nth-child(5) { animation-delay: .24s; } .fx-tile:nth-child(6) { animation-delay: .3s; }
.fx-avatar { position: relative; width: 112px; height: 112px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; transition: transform .3s ease-in-out; }
@media (min-width: 560px) { .fx-avatar { width: 144px; height: 144px; } }
@media (hover: hover) { .fx-avatar:hover { transform: translateY(-8px); } .fx-avatar:hover .fx-avatar-bg { box-shadow: 0 12px 24px rgba(19,147,55,.2); } }
.fx-avatar:active { transform: scale(.96); }
.fx-avatar:focus-visible { outline: 3px solid var(--go); outline-offset: 4px; }
.fx-avatar-bg { position: absolute; inset: 0; border-radius: 50%; background: var(--muted); transition: box-shadow .3s; }
.fx-avatar .fx-face, .fx-add { position: relative; }
.fx-add { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; color: var(--ink-soft); }
.fx-name { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--ink-soft); transition: color .2s; }
.fx-tile:hover .fx-name { color: var(--ink); }

/* 3. agregar niño */
.fx-kid-card { width: 100%; max-width: 28rem; overflow: hidden; border-radius: 24px; background: linear-gradient(#fff, #fbf7f0); box-shadow: 0 20px 50px rgba(42,33,24,.14); animation: fx-up .45s var(--fx-ease); }
.fx-kid-band { height: 8rem; background: linear-gradient(90deg, rgba(19,147,55,.22), rgba(19,147,55,.1)); animation: fx-band .6s var(--fx-ease); }
@keyframes fx-band { from { height: 0; opacity: 0; } to { height: 8rem; opacity: 1; } }
.fx-kid-body { padding: 0 28px 28px; margin-top: -4rem; text-align: center; }
.fx-big { width: 160px; height: 160px; margin: 0 auto; overflow: hidden; border: 4px solid #fff; border-radius: 50%; background: #fff; box-shadow: 0 6px 18px rgba(42,33,24,.12); animation: fx-up .5s var(--fx-spring); }
.fx-big-spin { width: 100%; height: 100%; transition: transform .8s cubic-bezier(.4,0,.2,1); }
.fx-kid-name { margin: 16px 0 0; font-family: var(--display); font-size: 1.6rem; font-weight: 800; animation: fx-up .4s ease .3s both; }
.fx-kid-sub { margin: 2px 0 0; font-size: .95rem; color: var(--ink-soft); animation: fx-up .4s ease .4s both; }
.fx-pickrow { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin: 22px 0; }
.fx-mini { position: relative; width: 52px; height: 52px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: none; cursor: pointer;
  animation: fx-up .35s var(--fx-spring) both; animation-delay: calc(.2s + var(--i) * .1s); transition: transform .2s; }
.fx-mini:hover { transform: translateY(-2px); }
.fx-mini[aria-pressed='true'] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--go); }
.fx-kid-input { margin-bottom: 18px; }
.fx-kid-actions { justify-content: center; }

/* tarjetas del Rincón de padres: aire parejo entre título, texto y botones (antes los botones quedaban
   pegados al texto y uno encima del otro) */
.parent-card > h2 { margin: 0; }
.parent-card > * + * { margin-top: 14px; }
.parent-card > h2 + * { margin-top: 8px; }
.parent-card > .steps-note { margin-bottom: 0; }
.parent-card > .btn3d + .btn3d { margin-top: 12px; }
.parent-card > .steps-note + .btn3d,
.parent-card > .steps-note + [hidden] + .btn3d { margin-top: 18px; }
/* íconos de la cuenta familiar: el tamaño general de svg del app los encogía */
.fx-ring svg { width: 44px; height: 44px; }
.fx-add svg { width: 48px; height: 48px; }
.fx-back svg { width: 22px; height: 22px; }
.fx-btn-spin svg { width: 20px; height: 20px; }
.fx-error svg { width: 15px; height: 15px; }
.fx-inline { white-space: nowrap; }
