/* web/app/shell/shell.css — Estructura, componentes, mascota y celebraciones del cascarón. Dueño: S6.
   Prefijo .shl-; solo variables de tokens.css. Mobile-first (iPhone 375–430 px), sin :hover obligatorio. */

/* ───────── Estructura ───────── */
.shl-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--c-bg);
}

.shl-app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.shl-view {
  position: relative;
  flex: 1;
  min-height: 0;
}

.shl-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
}

.shl-screen.is-entering {
  animation: shl-enter var(--dur-med) var(--ease-out);
}

@keyframes shl-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.shl-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: var(--sp-4) max(calc(var(--sp-4) + var(--safe-right)), calc((100% - 620px) / 2))
    var(--sp-6) max(calc(var(--sp-4) + var(--safe-left)), calc((100% - 620px) / 2));
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.shl-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.shl-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.shl-layer > * {
  pointer-events: auto;
}

/* ───────── Barra inferior ───────── */
.shl-tabbar {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: var(--sp-1) var(--safe-right) calc(var(--sp-1) + var(--safe-bottom)) var(--safe-left);
  background: var(--c-surface);
  border-top: 2px solid var(--c-border);
}

.shl-tab {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--c-text-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--r-md);
  -webkit-tap-highlight-color: transparent;
}

.shl-tab__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 32px;
  border-radius: var(--r-pill);
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.shl-tab.is-active {
  color: var(--c-primary);
}

.shl-tab.is-active .shl-tab__icon {
  background: color-mix(in srgb, var(--c-primary) 16%, transparent);
}

.shl-tab:active .shl-tab__icon {
  transform: scale(0.92);
}

.shl-tab__badge {
  position: absolute;
  top: -4px;
  right: 2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--c-error);
  color: var(--c-on-accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--c-surface);
}

/* ───────── Cabeceras ───────── */
.shl-topbar {
  flex: none;
  padding: calc(var(--sp-2) + var(--safe-top)) calc(var(--sp-3) + var(--safe-right)) var(--sp-2)
    calc(var(--sp-3) + var(--safe-left));
  background: var(--c-surface);
  border-bottom: 2px solid var(--c-border);
}

.shl-statsbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 620px;
  margin: 0 auto;
}

.shl-head {
  flex: none;
  display: grid;
  grid-template-columns: var(--tap-min) 1fr var(--tap-min);
  align-items: center;
  gap: var(--sp-2);
  padding: calc(var(--sp-2) + var(--safe-top)) calc(var(--sp-2) + var(--safe-right)) var(--sp-2)
    calc(var(--sp-2) + var(--safe-left));
  background: var(--c-surface);
  border-bottom: 2px solid var(--c-border);
}

.shl-head--plain {
  grid-template-columns: 1fr;
  padding-left: calc(var(--sp-4) + var(--safe-left));
}

.shl-head__titles {
  min-width: 0;
  text-align: center;
}

.shl-head--plain .shl-head__titles,
.shl-head--plain .shl-head__title {
  text-align: left;
}

.shl-head__title {
  font-size: var(--fs-lg);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shl-head__title--small {
  font-size: var(--fs-md);
  color: var(--c-text-muted);
}

.shl-head__sub {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}

.shl-head__spacer {
  display: block;
  width: var(--tap-min);
}

/* ───────── Botones ───────── */
.shl-btn {
  --btn-bg: var(--c-primary);
  --btn-fg: var(--c-on-primary);
  --btn-edge: var(--c-primary-press);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 52px;
  min-width: var(--tap-min);
  padding: 0 var(--sp-5);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 0 var(--btn-edge);
  transform: translateY(0);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast);
}

.shl-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--btn-edge);
}

.shl-btn:disabled {
  opacity: 0.45;
}

.shl-btn.is-busy {
  opacity: 0.7;
}

.shl-btn.is-busy::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: shl-spin 0.8s linear infinite;
}

@keyframes shl-spin {
  to {
    transform: rotate(360deg);
  }
}

.shl-btn--block {
  display: flex;
  width: 100%;
}

.shl-btn--small {
  min-height: var(--tap-min);
  padding: 0 var(--sp-4);
  font-size: var(--fs-sm);
}

.shl-btn--secondary {
  --btn-bg: var(--c-surface);
  --btn-fg: var(--c-primary);
  --btn-edge: var(--c-border);
  border-color: var(--c-border);
}

.shl-btn--ghost,
.shl-btn--ghost-danger {
  --btn-bg: transparent;
  --btn-fg: var(--c-primary);
  --btn-edge: transparent;
  box-shadow: none;
}

.shl-btn--ghost-danger {
  --btn-fg: var(--c-error);
}

.shl-btn--success {
  --btn-bg: var(--c-success);
  --btn-fg: var(--c-on-accent);
  --btn-edge: color-mix(in srgb, var(--c-success) 70%, #000);
}

.shl-btn--danger {
  --btn-bg: var(--c-error);
  --btn-fg: var(--c-on-accent);
  --btn-edge: color-mix(in srgb, var(--c-error) 70%, #000);
}

.shl-iconbtn {
  display: grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--c-text-muted);
  transition: background var(--dur-fast), transform var(--dur-fast);
}

.shl-iconbtn:active {
  background: var(--c-surface-2);
  transform: scale(0.94);
}

.shl-linkbtn {
  min-height: var(--tap-min);
  padding: 0 var(--sp-2);
  border: 0;
  background: none;
  color: var(--c-primary);
  font-weight: 700;
}

.shl-linkbtn:disabled {
  color: var(--c-text-muted);
}

.shl-chipbtn {
  min-height: 40px;
  padding: 0 var(--sp-3);
  border: 2px solid var(--c-border);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-text-muted);
  font-weight: 700;
  font-size: var(--fs-sm);
  /* el área táctil llega a 48 px con el margen invisible */
  box-shadow: 0 0 0 4px transparent;
}

.shl-chipbtn.is-selected {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: color-mix(in srgb, var(--c-primary) 10%, var(--c-surface));
}

/* ───────── Estadísticas ───────── */
.shl-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap-min);
  padding: 0 var(--sp-2);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}

button.shl-stat:active {
  background: var(--c-surface-2);
}

.shl-stat--streak .shl-icon {
  color: var(--c-streak);
}

.shl-stat--xp .shl-icon {
  color: var(--c-xp);
}

.shl-stat--lives .shl-icon {
  color: var(--c-life);
}

.shl-stat.is-dim .shl-icon {
  filter: grayscale(1);
  opacity: 0.45;
}

.shl-ic-flame-in {
  color: var(--c-xp);
}

.shl-ic-xp-shine,
.shl-ic-heart-shine {
  color: #fff;
  opacity: 0.55;
}

.shl-ic-crown-base {
  opacity: 0.75;
}

.is-pop {
  animation: shl-pop 0.55s var(--ease-bounce);
}

.is-shake {
  animation: shl-shake 0.5s ease-in-out;
}

@keyframes shl-pop {
  40% {
    transform: scale(1.3);
  }
}

@keyframes shl-shake {
  20%,
  60% {
    transform: translateX(-6px) rotate(-6deg);
  }
  40%,
  80% {
    transform: translateX(6px) rotate(6deg);
  }
}

/* ───────── Tarjetas, listas y campos ───────── */
.shl-card {
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}

.shl-card__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-md);
  margin-bottom: var(--sp-2);
}

.shl-section-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-lg);
  margin-top: var(--sp-2);
}

.shl-hint {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}

.shl-loading {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  text-align: center;
  padding: var(--sp-3);
}

.shl-label {
  display: block;
  font-weight: 800;
  margin-bottom: var(--sp-2);
}

.shl-input {
  width: 100%;
  min-height: 54px;
  padding: 0 var(--sp-4);
  border: 2px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface-2);
  color: var(--c-text);
  font-size: 18px;
  transition: border-color var(--dur-fast);
}

.shl-input:focus {
  border-color: var(--c-primary);
  background: var(--c-surface);
}

.shl-input::placeholder {
  color: var(--c-text-muted);
  opacity: 0.8;
}

.shl-input--code {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.45em;
  padding-left: calc(var(--sp-4) + 0.45em);
  font-variant-numeric: tabular-nums;
}

.shl-bar {
  position: relative;
  height: 16px;
  border-radius: var(--r-pill);
  background: var(--c-surface-2);
  overflow: hidden;
}

.shl-bar__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--c-success);
  transition: width var(--dur-slow) var(--ease-out);
  position: relative;
}

.shl-bar__fill::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 3px;
  height: 4px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.35);
}

.shl-ring__track {
  stroke: var(--c-border);
}

.shl-ring__fill {
  stroke: var(--lv, var(--c-primary));
  transition: stroke-dasharray var(--dur-slow) var(--ease-out);
}

/* Lista agrupada (ajustes) */
.shl-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.shl-group__title {
  font-size: var(--fs-sm);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-muted);
  padding-left: var(--sp-2);
}

.shl-group__card {
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.shl-group__card > * + * {
  border-top: 1px solid var(--c-border);
}

.shl-row,
.shl-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 58px;
  padding: var(--sp-3) var(--sp-4);
  width: 100%;
  text-align: left;
}

.shl-field {
  flex-wrap: wrap;
}

.shl-field--stacked {
  flex-direction: column;
  align-items: stretch;
}

.shl-row--action {
  border: 0;
  background: transparent;
  color: var(--c-text);
  justify-content: flex-start;
}

.shl-row--action:active {
  background: var(--c-surface-2);
}

.shl-row--action > .shl-icon:first-child {
  color: var(--c-primary);
  flex: none;
}

.shl-row--action.is-danger,
.shl-row--action.is-danger > .shl-icon:first-child {
  color: var(--c-error);
}

.shl-row__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.shl-row__label {
  font-weight: 700;
}

.shl-row__hint {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}

.shl-row__value {
  color: var(--c-text-muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.shl-row__chev {
  color: var(--c-text-muted);
  flex: none;
}

.shl-row.is-disabled,
.shl-field.is-disabled {
  opacity: 0.55;
}

/* Interruptor */
.shl-switch {
  flex: none;
  position: relative;
  width: 56px;
  height: 34px;
  margin: 7px 0;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--c-locked);
  padding: 0;
  transition: background var(--dur-fast);
}

.shl-switch::before {
  /* área táctil de 48 px */
  content: '';
  position: absolute;
  inset: -7px -4px;
}

.shl-switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-med) var(--ease-bounce);
}

.shl-switch[aria-checked='true'] {
  background: var(--c-success);
}

.shl-switch[aria-checked='true'] .shl-switch__knob {
  transform: translateX(22px);
}

/* Control segmentado */
.shl-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--c-surface-2);
}

.shl-field--stacked .shl-seg {
  width: 100%;
  flex-direction: column;
}

.shl-seg__opt {
  flex: 1 1 auto;
  min-height: 44px;
  min-width: 72px;
  padding: 0 var(--sp-3);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--c-text-muted);
  font-weight: 700;
  font-size: var(--fs-sm);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.shl-seg__opt.is-selected {
  background: var(--c-surface);
  color: var(--c-primary);
  box-shadow: var(--shadow-1);
}

/* ───────── Estado vacío y arranque ───────── */
.shl-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-4) calc(var(--sp-6) + var(--safe-bottom));
}

.shl-empty__title {
  font-size: var(--fs-xl);
}

.shl-empty__text {
  color: var(--c-text-muted);
  max-width: 34ch;
}

.shl-empty .shl-btn {
  margin-top: var(--sp-3);
  min-width: 220px;
}

.shl-splash {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
}

.shl-splash__dots {
  display: flex;
  gap: 8px;
}

.shl-splash__dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-primary);
  animation: shl-blink 1.1s infinite ease-in-out;
}

.shl-splash__dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.shl-splash__dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes shl-blink {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-5px);
  }
}

/* ───────── Hoja modal, avisos y actualización ───────── */
.shl-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--c-overlay);
  animation: shl-fade var(--dur-med) var(--ease-out);
}

.shl-overlay.is-leaving {
  opacity: 0;
  transition: opacity 180ms;
}

.shl-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 90%;
  overflow-y: auto;
  padding: var(--sp-5) calc(var(--sp-4) + var(--safe-right)) calc(var(--sp-4) + var(--safe-bottom))
    calc(var(--sp-4) + var(--safe-left));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--c-surface);
  box-shadow: var(--shadow-2);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  animation: shl-slide-up var(--dur-med) var(--ease-out);
}

.shl-sheet__mascot {
  display: flex;
  justify-content: center;
}

.shl-sheet__title {
  font-size: var(--fs-lg);
}

.shl-sheet__text {
  color: var(--c-text-muted);
}

.shl-sheet__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

@keyframes shl-fade {
  from {
    opacity: 0;
  }
}

@keyframes shl-slide-up {
  from {
    transform: translateY(40%);
    opacity: 0.4;
  }
}

.shl-toasts {
  position: fixed;
  left: 50%;
  top: calc(var(--sp-3) + var(--safe-top));
  transform: translateX(-50%);
  width: min(92vw, 520px);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: 60;
  pointer-events: none;
}

.shl-toast {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-text);
  color: var(--c-text-inverse);
  font-weight: 700;
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-2);
  animation: shl-toast-in var(--dur-med) var(--ease-bounce);
}

.shl-toast .shl-icon {
  flex: none;
}

.shl-toast--ok {
  background: var(--c-success);
  color: var(--c-on-accent);
}

.shl-toast--error {
  background: var(--c-error);
  color: var(--c-on-accent);
}

.shl-toast.is-leaving {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 220ms, transform 220ms;
}

@keyframes shl-toast-in {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.96);
  }
}

.shl-update {
  position: fixed;
  left: 50%;
  bottom: calc(76px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(92vw, 520px);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--c-primary);
  color: var(--c-on-primary);
  font-weight: 700;
  box-shadow: var(--shadow-2);
}

.shl-update span {
  flex: 1;
}

.shl-update__btn {
  min-height: var(--tap-min);
  padding: 0 var(--sp-4);
  border: 0;
  border-radius: var(--r-sm);
  background: var(--c-on-primary);
  color: var(--c-primary);
  font-weight: 800;
}

/* ───────── Mascota «Burbu» ───────── */
.shl-mascot {
  --shl-m-ink: #17203a;
  overflow: visible;
  flex: none;
}

.shl-mascot .shl-m-figure,
.shl-mascot .shl-m-shadow,
.shl-mascot .shl-m-sprout,
.shl-mascot .shl-m-dots circle,
.shl-mascot .shl-m-tear,
.shl-mascot .shl-m-spark {
  transform-box: view-box;
}

.shl-m-shadow {
  fill: var(--c-text);
  opacity: 0.1;
  transform-origin: 60px 112px;
}

.shl-mascot--feliz .shl-m-x:not(.is-feliz),
.shl-mascot--pensando .shl-m-x:not(.is-pensando),
.shl-mascot--triste .shl-m-x:not(.is-triste),
.shl-mascot--celebrando .shl-m-x:not(.is-celebrando) {
  display: none;
}

.shl-m-figure {
  transform-origin: 60px 108px;
}

.shl-m-sprout {
  transform-origin: 60px 24px;
  animation: shl-m-sway 3.2s ease-in-out infinite;
}

.shl-mascot--feliz .shl-m-figure {
  animation: shl-m-bob 2.6s ease-in-out infinite;
}

.shl-mascot--pensando .shl-m-figure {
  animation: shl-m-tilt 3s ease-in-out infinite;
}

.shl-mascot--pensando .shl-m-dots circle {
  animation: shl-m-dot 1.5s ease-in-out infinite;
}

.shl-mascot--pensando .shl-m-dots circle:nth-child(2) {
  animation-delay: 0.2s;
}

.shl-mascot--pensando .shl-m-dots circle:nth-child(3) {
  animation-delay: 0.4s;
}

.shl-mascot--triste .shl-m-figure {
  animation: shl-m-sag 3.4s ease-in-out infinite;
}

.shl-mascot--triste .shl-m-tear {
  transform-origin: 80px 66px;
  animation: shl-m-tear 2.4s ease-in infinite;
}

.shl-mascot--triste .shl-m-body {
  filter: saturate(0.7);
}

.shl-mascot--celebrando .shl-m-figure {
  animation: shl-m-jump 0.8s var(--ease-out) infinite;
}

.shl-mascot--celebrando .shl-m-shadow {
  animation: shl-m-shadow 0.8s var(--ease-out) infinite;
}

.shl-m-spark {
  transform-origin: center;
  animation: shl-m-twinkle 1.2s ease-in-out infinite;
}

@keyframes shl-m-bob {
  0%,
  100% {
    transform: translateY(0) scale(1, 1);
  }
  50% {
    transform: translateY(-4px) scale(1.01, 0.99);
  }
}

@keyframes shl-m-sway {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(6deg);
  }
}

@keyframes shl-m-tilt {
  0%,
  100% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(4deg);
  }
}

@keyframes shl-m-dot {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

@keyframes shl-m-sag {
  0%,
  100% {
    transform: scale(1, 1);
  }
  50% {
    transform: scale(1.02, 0.96);
  }
}

@keyframes shl-m-tear {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: translateY(26px);
    opacity: 0;
  }
}

@keyframes shl-m-jump {
  0%,
  100% {
    transform: translateY(0) scale(1.04, 0.95);
  }
  45% {
    transform: translateY(-14px) scale(0.97, 1.04);
  }
}

@keyframes shl-m-shadow {
  45% {
    transform: scale(0.7);
    opacity: 0.05;
  }
}

@keyframes shl-m-twinkle {
  0%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

/* ───────── Celebraciones ───────── */
.shl-confetti {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none !important;
  z-index: 70;
}

.shl-confetti__p {
  position: absolute;
  top: -24px;
  border-radius: 2px;
  animation-name: shl-fall;
  animation-timing-function: cubic-bezier(0.25, 0.6, 0.45, 1);
  animation-fill-mode: forwards;
  opacity: 0.95;
}

.shl-confetti__p.is-round {
  border-radius: 50%;
}

@keyframes shl-fall {
  to {
    transform: translate3d(var(--dx), 110vh, 0) rotate(var(--rot));
  }
}

.shl-float-xp {
  position: fixed;
  left: 50%;
  top: 38%;
  z-index: 65;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-text);
  font-weight: 800;
  box-shadow: var(--shadow-2);
  pointer-events: none !important;
  transform: translateX(-50%);
  animation: shl-float 1.3s var(--ease-out) forwards;
}

.shl-float-xp .shl-icon {
  color: var(--c-xp);
}

@keyframes shl-float {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -46px) scale(1);
  }
}

.shl-celebrate {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: var(--c-overlay);
  animation: shl-fade var(--dur-med) var(--ease-out);
}

.shl-celebrate.is-leaving {
  opacity: 0;
  transition: opacity 200ms;
}

.shl-streakfx,
.shl-achfx {
  position: relative;
  width: min(86vw, 360px);
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--shadow-2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  animation: shl-pop-in var(--dur-slow) var(--ease-bounce);
}

@keyframes shl-pop-in {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}

.shl-streakfx__glow {
  position: absolute;
  top: 18px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c-streak) 45%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity var(--dur-slow);
}

.shl-streakfx__flame {
  position: relative;
  filter: grayscale(1);
  opacity: 0.45;
  transform: scale(0.85);
  transition: filter var(--dur-slow) var(--ease-out), opacity var(--dur-slow), transform var(--dur-slow) var(--ease-bounce);
}

.shl-streakfx__flame .shl-icon {
  color: var(--c-streak);
}

.shl-streakfx__flame.is-lit {
  filter: none;
  opacity: 1;
  transform: scale(1);
  animation: shl-flicker 1.4s ease-in-out 0.6s infinite;
}

.shl-streakfx__flame.is-lit ~ .shl-streakfx__num,
.shl-streakfx:has(.is-lit) .shl-streakfx__glow {
  opacity: 1;
}

@keyframes shl-flicker {
  0%,
  100% {
    transform: scale(1) rotate(0);
  }
  30% {
    transform: scale(1.04, 0.98) rotate(-2deg);
  }
  60% {
    transform: scale(0.98, 1.04) rotate(2deg);
  }
}

.shl-streakfx__num {
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  color: color-mix(in srgb, var(--c-streak) 78%, var(--c-text));
  font-variant-numeric: tabular-nums;
}

.shl-streakfx__title,
.shl-achfx__name {
  font-size: var(--fs-xl);
}

.shl-streakfx__text,
.shl-achfx__text {
  color: var(--c-text-muted);
}

.shl-achfx__badge {
  display: grid;
  place-items: center;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c-xp) 22%, var(--c-surface));
  border: 4px solid var(--c-xp);
  color: var(--c-xp);
  animation: shl-pop 0.8s var(--ease-bounce) 0.2s;
}

.shl-achfx__kicker {
  font-size: var(--fs-sm);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-warning);
}

.shl-ic-trophy {
  color: var(--c-xp);
}
