/* ============================================================================
   LAB42 ACADEMY — app v2
   "La Sala 42": un cuarto de juego y aprendizaje.
   ========================================================================= */

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: var(--bar-h) 1fr;
  grid-template-columns: minmax(0, 1fr);
  background: transparent;
}

.app > * {
  min-width: 0;
}

/* ================================================================ BARRA = */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-bar);
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding-inline: var(--gutter);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 3px solid var(--line);
  min-width: 0;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar__nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  background: var(--card-soft);
  border: 2px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar__nav::-webkit-scrollbar {
  display: none;
}
.topbar__nav a {
  padding: 0.45rem 0.95rem;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--ink-2);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background var(--t-base) var(--ease-soft), color var(--t-base);
}
.topbar__nav a:hover {
  color: var(--ink);
}
.topbar__nav a[aria-current="page"] {
  background: var(--grape);
  color: #fff;
}

.purse {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.purse__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--r-pill);
  background: var(--sun-soft);
  border: 2px solid color-mix(in srgb, var(--sun) 45%, transparent);
  font-size: var(--fs-xs);
  font-weight: 800;
  color: #7a5805;
}
.purse__item--coin {
  background: var(--mint-soft);
  border-color: color-mix(in srgb, var(--mint) 40%, transparent);
  color: var(--mint-deep);
}
.purse__item--streak {
  background: var(--melon-soft);
  border-color: color-mix(in srgb, var(--melon) 42%, transparent);
  color: var(--melon-deep);
}

@media (max-width: 1080px) {
  .topbar__nav {
    display: none;
  }
}

/* Barra inferior en móvil (máx. 5 destinos) */
.tabbar {
  display: none;
  position: fixed;
  inset: auto 0 0 0;
  z-index: var(--z-nav);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 3px solid var(--line);
  padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 56px;
  min-height: 52px;
  padding: 0.35rem 0.5rem;
  border-radius: var(--r-md);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ink-2);
  transition: background var(--t-base) var(--ease-soft), color var(--t-base);
}
.tabbar a[aria-current="page"] {
  background: var(--grape-soft);
  color: var(--grape-deep);
}
.tabbar__icon {
  font-size: 1.35rem;
  line-height: 1;
}
@media (max-width: 1080px) {
  .tabbar {
    display: flex;
  }
  .app {
    padding-bottom: 78px;
  }
}

/* =============================================================== VISTAS = */
.view {
  padding: var(--sp-6) var(--gutter) var(--sp-8);
  max-width: var(--content-max);
  margin-inline: auto;
  width: 100%;
  min-width: 0;
}
.view__head {
  margin-bottom: var(--sp-6);
}
.view__title {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.5rem);
  font-weight: 700;
}

/* =============================================================== BIENVENIDA */
.welcome {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-6) var(--gutter);
  overflow: hidden;
}
.welcome__blob {
  position: absolute;
  border-radius: 46% 54% 60% 40% / 55% 45% 55% 45%;
  filter: blur(2px);
  opacity: 0.55;
  animation: blob 18s ease-in-out infinite;
  pointer-events: none;
}
@keyframes blob {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  33% {
    transform: translate(3%, -4%) rotate(6deg) scale(1.06);
  }
  66% {
    transform: translate(-3%, 3%) rotate(-5deg) scale(0.96);
  }
}
.welcome__inner {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  width: 100%;
}
.welcome__stage {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
}
@media (max-width: 780px) {
  .welcome__stage {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .welcome__copy {
    order: 2;
  }
  .welcome__nova {
    order: 1;
    display: flex;
    justify-content: center;
  }
}
.welcome__copy {
  min-width: 0;
}
.welcome__title {
  font-size: clamp(1.9rem, 1.15rem + 2.8vw, 3.1rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  margin-top: var(--sp-3);
  max-width: 19ch;
}
/* Resaltador de cuaderno: la frase que sostiene la promesa. */
.welcome__title .mark {
  background: linear-gradient(transparent 58%, var(--sun-soft) 58%, var(--sun-soft) 94%, transparent 94%);
  padding: 0 0.12em;
  border-radius: 2px;
}
.welcome__lead {
  font-size: var(--fs-lead);
  color: var(--ink-2);
  max-width: 56ch;
  margin-top: var(--sp-3);
}
@media (max-width: 780px) {
  .welcome__title {
    margin-inline: auto;
  }
  .welcome__lead {
    margin-inline: auto;
  }
}
.welcome__nova {
  flex: 0 0 auto;
}
.welcome__pills {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--sp-4);
}
.welcome__pills--start {
  justify-content: flex-start;
}
@media (max-width: 780px) {
  .welcome__pills--start {
    justify-content: center;
  }
}
.welcome__note {
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* ================================================================ HUB === */
.hub {
  display: grid;
  gap: var(--sp-6);
}

.greet {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--sp-5);
  align-items: center;
  padding: var(--sp-5) var(--sp-6);
  border-radius: var(--r-2xl);
  background: linear-gradient(135deg, var(--card), var(--grape-soft));
  border: 3px solid var(--line);
  box-shadow: var(--clay-2);
  overflow: hidden;
}
@media (max-width: 760px) {
  .greet {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }
}
.greet__bubble {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--ink);
}
.greet__bubble b {
  font-family: var(--font-display);
  color: var(--grape-deep);
}
.greet__who {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: 0.35rem;
}

.nova {
  width: 96px;
  height: 96px;
  flex: none;
  filter: drop-shadow(0 10px 18px rgba(46, 42, 71, 0.22));
}
.nova--sm {
  width: 56px;
  height: 56px;
}

/* Continuar: la tarjeta protagonista */
.continue {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-5);
  align-items: center;
  padding: var(--sp-5) var(--sp-6);
  border-radius: var(--r-2xl);
  background: var(--card);
  border: 3px solid var(--accent, var(--grape));
  box-shadow: var(--clay-2);
  overflow: hidden;
}
@media (max-width: 700px) {
  .continue {
    grid-template-columns: 1fr;
  }
}
.continue::before {
  content: "";
  position: absolute;
  right: -60px;
  top: -70px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent, var(--grape)) 16%, transparent);
}
.continue__badge {
  width: 76px;
  height: 76px;
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  font-size: 2.1rem;
  background: color-mix(in srgb, var(--accent, var(--grape)) 15%, #fff);
  border: 3px solid color-mix(in srgb, var(--accent, var(--grape)) 38%, transparent);
  flex: none;
}

/* Puertas de los pilares */
.doors {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-4);
}
@media (max-width: 1100px) {
  .doors {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .doors {
    grid-template-columns: minmax(0, 1fr);
  }
}

.door {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border-radius: var(--r-xl);
  background: var(--card);
  border: 3px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: var(--clay-1);
  text-align: left;
  overflow: hidden;
  transition: transform var(--t-base) var(--ease-soft),
    box-shadow var(--t-base) var(--ease-soft);
}
.door:hover {
  transform: translateY(-5px) rotate(-0.6deg);
  box-shadow: var(--clay-3);
}
.door__top {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.door__icon {
  width: 54px;
  height: 54px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  background: color-mix(in srgb, var(--accent) 14%, #fff);
  border: 2.5px solid color-mix(in srgb, var(--accent) 36%, transparent);
  flex: none;
}
.door__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
}
.door__sub {
  font-size: var(--fs-xs);
  color: var(--ink-2);
  font-weight: 700;
}
.door__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  font-weight: 700;
}

/* Recompensas */
.loot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
}
@media (max-width: 720px) {
  .loot {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.loot__item {
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--card);
  border: 3px solid var(--line);
  box-shadow: var(--clay-1);
}

/* ============================================================= MISIONES = */
.mission {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: var(--sp-5);
  align-items: start;
}
@media (max-width: 1040px) {
  .mission {
    grid-template-columns: 1fr;
  }
}

.trail {
  display: flex;
  gap: 6px;
  margin-bottom: var(--sp-5);
}
.trail__step {
  flex: 1;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--card-soft);
  border: 2px solid var(--line);
  overflow: hidden;
}
.trail__step::after {
  content: "";
  display: block;
  height: 100%;
  width: 0;
  background: var(--grape);
  transition: width var(--t-enter) var(--ease-soft);
}
.trail__step[data-done="true"]::after {
  width: 100%;
}

.stage {
  border-radius: var(--r-2xl);
  background: var(--card);
  border: 3px solid var(--line);
  box-shadow: var(--clay-2);
  padding: var(--sp-5);
  min-height: 460px;
  display: flex;
  flex-direction: column;
  animation: rise var(--t-enter) var(--ease-soft) both;
}
.stage__hud {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.stage__prompt {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--card-soft);
  border-left: 5px solid var(--accent, var(--grape));
}
.stage__feedback {
  margin-top: auto;
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  font-size: var(--fs-sm);
  line-height: 1.55;
  border: 3px solid var(--line);
  background: var(--card-soft);
  transition: border-color var(--t-base) var(--ease-soft);
}
.stage__feedback[data-tone="ok"] {
  border-color: var(--mint);
  background: var(--mint-soft);
}
.stage__feedback[data-tone="retry"] {
  border-color: var(--sun);
  background: var(--sun-soft);
}
.stage__feedback b {
  font-family: var(--font-display);
}

/* ================================================================ TABLERO */
.board {
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 3px solid var(--edge);
  box-shadow: var(--clay-2);
  user-select: none;
}
.sq {
  position: relative;
  display: grid;
  place-items: center;
  font-size: clamp(1.2rem, 3.9vw, 2.3rem);
  line-height: 1;
  cursor: pointer;
  transition: background var(--t-micro) var(--ease-soft),
    box-shadow var(--t-micro) var(--ease-soft);
}
.sq--l {
  background: #fff4e6;
}
.sq--d {
  background: #f3d9bd;
}
.sq--sel {
  box-shadow: inset 0 0 0 4px var(--grape);
}
.sq--move {
  background: color-mix(in srgb, var(--mint) 55%, #fff);
}
.sq--capture {
  background: color-mix(in srgb, var(--melon) 55%, #fff);
}
.sq--last {
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--sun) 75%, transparent);
}
.sq--hint::after {
  content: "";
  position: absolute;
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: color-mix(in srgb, var(--mint) 85%, transparent);
}
.sq__coord {
  position: absolute;
  font-size: 0.6rem;
  font-weight: 800;
  color: rgba(46, 42, 71, 0.35);
}
.sq__coord.b {
  bottom: 2px;
  left: 4px;
}
.sq__coord.t {
  top: 2px;
  right: 4px;
}
.pc {
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 3px rgba(59, 47, 74, 0.22);
  transform: translateY(-2%);
  transition: transform var(--t-micro) var(--ease-pop);
  paint-order: stroke fill;
}
.sq:hover .pc {
  transform: translateY(-6%) scale(1.06);
}
.pc--w {
  color: #ffffff;
  -webkit-text-stroke: 2.4px #3b2f4a;
}
.pc--b {
  color: #3b2f4a;
  -webkit-text-stroke: 2.4px #ffffff;
  text-shadow: 0 2px 3px rgba(59, 47, 74, 0.2);
}

/* =============================================================== FINANZAS */
.market {
  display: grid;
  gap: var(--sp-4);
}
.market__wallet {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--mint-soft);
  border: 3px solid color-mix(in srgb, var(--mint) 40%, transparent);
  --accent: var(--mint);
}
.market__goal {
  flex: 1;
}
.market__options {
  display: grid;
  gap: var(--sp-3);
}
.market__option {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--card);
  border: 3px solid var(--line);
  cursor: pointer;
  text-align: left;
  transition: all var(--t-base) var(--ease-soft);
}
.market__option:hover {
  border-color: var(--mint);
  transform: translateY(-2px);
  box-shadow: var(--clay-1);
}
.market__option[data-selected="true"] {
  border-color: var(--mint);
  background: var(--mint-soft);
}
.market__price {
  font-weight: 800;
  color: var(--mint-deep);
  flex: none;
}
.market__price--bad {
  color: var(--melon-deep);
}

/* ============================================================== CIENCIAS */
.lab {
  display: grid;
  gap: var(--sp-4);
}
.lab__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: var(--card-soft);
  padding: 8px;
  border-radius: var(--r-lg);
  border: 3px solid var(--line);
}
.lab__cell {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  background: #fff;
  border: 3px dashed var(--line-2);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  transition: all var(--t-base) var(--ease-soft);
}
.lab__cell[data-occupied="true"] {
  border-style: solid;
  border-color: transparent;
  background: var(--card);
}
.lab__cell[data-selected="true"] {
  box-shadow: 0 0 0 4px var(--grape-soft);
  border-color: var(--grape);
}
.lab__cell--wire {
  background: var(--mint);
  border-color: var(--mint-deep);
}
.lab__cell--lamp {
  background: #efeafd;
}
.lab__cell--lamp[data-lit="true"] {
  background: var(--sun);
  box-shadow: 0 0 20px color-mix(in srgb, var(--sun) 85%, transparent);
}
.lab__cell--battery {
  background: var(--sky);
  border-color: var(--sky-deep);
}
.lab__cell--switch {
  background: var(--line);
}
.lab__cell--switch[data-on="true"] {
  background: var(--mint);
}
.lab__legend {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  font-weight: 700;
}
.lab__legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: -2px;
}

/* ================================================================ MÚSICA = */
.rhythm {
  position: relative;
  height: 400px;
  border-radius: var(--r-lg);
  background: var(--ink);
  border: 3px solid var(--edge);
  overflow: hidden;
}
.rhythm__lane {
  position: absolute;
  bottom: 0;
  top: 0;
  width: 25%;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}
.rhythm__hit {
  position: absolute;
  bottom: 8%;
  left: 0;
  right: 0;
  height: 26px;
  background: color-mix(in srgb, var(--sun) 30%, transparent);
  border-top: 3px solid var(--sun);
  border-radius: 6px;
}
.rhythm__note {
  position: absolute;
  width: 70%;
  left: 15%;
  height: 26px;
  border-radius: 8px;
  transform: translateY(-50%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}
.rhythm__note.hit {
  opacity: 0.25;
}
.rhythm__judge {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
}
.rhythm__judge[data-show="true"] {
  animation: judge-pop 620ms var(--ease-pop);
}
@keyframes judge-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -90%) scale(1);
  }
}
.lanes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
}
.lane-key {
  padding: 0.9rem 0.4rem;
  border-radius: var(--r-md);
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  border: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 20%, #fff);
  color: var(--ink);
  transition: transform var(--t-micro) var(--ease-pop),
    background var(--t-micro) var(--ease-soft);
}
.lane-key:active,
.lane-key[data-active="true"] {
  transform: scale(0.94);
  background: var(--c);
}

/* ================================================================= CHAT = */
.chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 400px;
  border-radius: var(--r-xl);
  background: var(--card);
  border: 3px solid var(--line);
  box-shadow: var(--clay-1);
  overflow: hidden;
  animation: rise var(--t-enter) var(--ease-soft) both;
  animation-delay: 80ms;
}
.chat__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 3px solid var(--line);
  background: var(--grape-soft);
}
.chat__log {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  scroll-behavior: smooth;
}
.msg {
  max-width: 88%;
  padding: 0.75rem 1rem;
  border-radius: var(--r-lg);
  font-size: var(--fs-sm);
  line-height: 1.5;
  font-weight: 500;
  animation: rise var(--t-base) var(--ease-soft) both;
}
.msg--nova {
  background: var(--card-soft);
  border: 2.5px solid var(--line);
  align-self: flex-start;
  border-bottom-left-radius: var(--r-xs);
}
.msg--kid {
  background: var(--grape);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: var(--r-xs);
}
.msg--sys {
  align-self: center;
  background: var(--sun-soft);
  border: 2.5px dashed color-mix(in srgb, var(--sun) 60%, transparent);
  font-size: var(--fs-xs);
  color: #7a5805;
  text-align: center;
  max-width: 96%;
}
.chat__input {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-top: 3px solid var(--line);
}
.chat__input input {
  flex: 1;
  padding: 0.7rem 0.95rem;
  border-radius: var(--r-pill);
  background: var(--card-soft);
  border: 2.5px solid var(--line);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.chat__input input:focus {
  outline: none;
  border-color: var(--grape);
}
.quick {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0 var(--sp-4) var(--sp-3);
}
.quick button {
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: var(--r-pill);
  background: var(--card-soft);
  border: 2px solid var(--line);
  color: var(--ink-2);
  transition: all var(--t-base) var(--ease-soft);
}
.quick button:hover {
  border-color: var(--grape);
  color: var(--grape-deep);
}

/* ============================================================ RELOJ PAUSA */
.timerbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--card);
  border: 3px solid var(--line);
  box-shadow: var(--clay-1);
}
.timerbar__label {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--ink-2);
}
.timerbar__clock {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.timerbar--break {
  border-color: var(--mint);
  background: var(--mint-soft);
}
.timerbar--warn {
  border-color: var(--sun);
  background: var(--sun-soft);
}

/* ============================================================== FAMILIA == */
.family {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: var(--sp-5);
  align-items: start;
}
@media (max-width: 1040px) {
  .family {
    grid-template-columns: 1fr;
  }
}
.family__col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}
.kidcard {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--card);
  border: 3px solid var(--line);
}
.bars {
  display: grid;
  gap: 0.2rem;
}
.bar {
  display: grid;
  grid-template-columns: 130px 1fr 56px;
  gap: var(--sp-3);
  align-items: center;
  padding-block: 0.35rem;
  font-size: var(--fs-sm);
  font-weight: 700;
}
@media (max-width: 560px) {
  .bar {
    grid-template-columns: 96px 1fr 46px;
  }
}
.bar__value {
  font-size: var(--fs-xs);
  text-align: right;
  color: var(--ink-2);
}

.report {
  padding: var(--sp-6);
  border-radius: var(--r-2xl);
  background: #fffdf8;
  border: 3px solid var(--edge);
  box-shadow: var(--clay-2);
}
.report h3 {
  color: var(--ink);
}
.report p,
.report li {
  color: var(--ink-2);
}
.report__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-4);
  padding-bottom: var(--sp-4);
  border-bottom: 3px solid var(--ink);
  margin-bottom: var(--sp-4);
}
.report__seal {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--grape);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  line-height: 1.15;
  flex: none;
  box-shadow: 0 4px 0 var(--grape-deep);
}
.phrase {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--sun-soft);
  border-left: 5px solid var(--sun);
  font-size: var(--fs-sm);
  font-style: italic;
  color: var(--ink);
  margin-bottom: var(--sp-2);
}
.phrase__tag {
  display: block;
  font-style: normal;
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: #8a6407;
  margin-bottom: 4px;
}

/* ============================================================ ONBOARDING = */
.steps {
  display: flex;
  gap: 6px;
  margin-bottom: var(--sp-6);
}
.steps__i {
  flex: 1;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--card-soft);
  border: 2px solid var(--line);
  overflow: hidden;
}
.steps__i::after {
  content: "";
  display: block;
  height: 100%;
  width: 0;
  background: var(--grape);
  transition: width var(--t-enter) var(--ease-soft);
}
.steps__i[data-done="true"]::after {
  width: 100%;
}

.q-block {
  padding: var(--sp-5);
  border-radius: var(--r-xl);
  background: var(--card);
  border: 3px solid var(--line);
  box-shadow: var(--clay-1);
  margin-bottom: var(--sp-4);
}
.q-block__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--grape-deep);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.q-item {
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  border: 2.5px solid var(--line);
  background: var(--card-soft);
  margin-bottom: var(--sp-3);
}
.q-item__text {
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-3);
  line-height: 1.5;
}
.scale {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.scale button {
  flex: 1 1 120px;
  padding: 0.65rem 0.5rem;
  border-radius: var(--r-md);
  border: 3px solid var(--line);
  background: #fff;
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--ink-2);
  transition: all var(--t-base) var(--ease-soft);
}
.scale button:hover {
  border-color: var(--grape);
}
.scale button[aria-pressed="true"] {
  background: var(--grape);
  color: #fff;
  border-color: var(--grape-deep);
}

/* ====================================================== FILAS Y MISIONES = */
/* Una misión dentro de una lista: la unidad de contenido del mapa de pilares. */
.mission-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--card);
  border: 2.5px solid var(--line);
  transition: border-color var(--t-base) var(--ease-soft),
    transform var(--t-micro) var(--ease-soft),
    box-shadow var(--t-base) var(--ease-soft);
}
.mission-row:hover {
  border-color: color-mix(in srgb, var(--accent, var(--grape)) 50%, var(--line));
  transform: translateX(3px);
  box-shadow: var(--clay-1);
}
.mission-row--locked {
  opacity: 0.55;
}
.mission-row__icon {
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  background: color-mix(in srgb, var(--accent, var(--grape)) 13%, #fff);
  border: 2.5px solid color-mix(in srgb, var(--accent, var(--grape)) 32%, transparent);
  flex: none;
}
.mission-row__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
}
.mission-row__meta {
  font-size: var(--fs-xs);
  color: var(--ink-2);
  font-weight: 600;
}
.mission-row__mastery {
  width: 96px;
  flex: none;
  display: flex;
  align-items: center;
}
.mission-row__mastery .progress {
  display: block;
  width: 100%;
}

/* ============================================================ CALCULADORA = */
.calc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: center;
}
@media (max-width: 900px) {
  .calc {
    grid-template-columns: 1fr;
  }
}
.calc__control {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: var(--sp-4);
}
.calc__control label {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
  font-weight: 800;
  color: var(--ink-2);
}
.calc__control label b {
  color: var(--grape-deep);
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--card-soft);
  border: 2px solid var(--line);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--grape);
  border: 4px solid #fff;
  box-shadow: 0 2px 0 var(--grape-deep);
  cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--grape);
  border: 4px solid #fff;
  cursor: grab;
}
.calc__out {
  padding: var(--sp-5);
  border-radius: var(--r-xl);
  background: var(--card-soft);
  border: 3px solid var(--line);
  box-shadow: var(--clay-1);
}

/* ============================================================== MISC = */
.btn--melon {
  --btn-bg: var(--melon);
  --btn-fg: #3a1b0c;
  --btn-edge: var(--melon-deep);
}
.pill-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.heat {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-weight: 800;
  font-size: var(--fs-xs);
}
.offline-note {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--sky-soft);
  border: 3px solid color-mix(in srgb, var(--sky) 35%, transparent);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  font-weight: 600;
}
.empty {
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  color: var(--ink-2);
}
.empty__icon {
  font-size: 3rem;
  margin-bottom: var(--sp-3);
}

@media print {
  .topbar,
  .tabbar,
  .chat,
  .toast-host {
    display: none !important;
  }
  body {
    background: #fff;
  }
}
