@layer components {
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1024px;
    z-index: 200;
    display: flex;
    justify-content: space-around;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: var(--radius-lg);
    min-height: var(--touch-target);
  }

  .bottom-nav__item:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
  }

  .bottom-nav__item svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-text-muted);
    /* `color` para los sub-paths con fill="currentColor" (el play del icono de
       Kicks): sin esto heredan el color del enlace y no siguen al estado. */
    color: var(--color-text-muted);
    stroke-width: 2;
    fill: none;
  }

  .bottom-nav__item span {
    font-size: 11px;
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
  }

  .bottom-nav__item--active svg {
    stroke: var(--color-accent-fg);
    /* Tiñe también el play del icono de Kicks (fill="currentColor") — antes se
       quedaba blanco mientras el marco se ponía verde. */
    color: var(--color-accent-fg);
  }

  .bottom-nav__item--active span {
    color: var(--color-accent-fg);
  }

  /* Light themes: surface bg blends into white body — elevate with subtle shadow */
  :root[data-theme^="light"] .bottom-nav {
    box-shadow: 0 -1px 3px rgb(0 0 0 / 5%);
  }

  /* ── Centre "Momento" slot: an elevated FAB (Mercado at launch; rotates to
     Juegos when it ships). Reuses the flex row; only the middle item lifts. ── */
  .bottom-nav__center {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 0 8px;
    text-decoration: none;
    /* raise the badge above the bar without growing the bar height */
    margin-top: -22px;
  }

  /* Reposo: orbe verde "dormido" — degradado direccional desaturado. Ya no va
     siempre a tope de verde; se ENCIENDE al pulsar (:active) y al estar en
     Mercado (--active). Todo derivado de --color-accent/--color-bg (sin hex). */
  .bottom-nav__fab {
    position: relative;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    /* Icono en reposo con `--color-accent-fg` (accent legible como foreground):
       verde brillante sobre el orbe oscuro en dark, verde oscuro sobre el orbe
       pálido en light-pure → contraste WCAG en AMBOS temas (color-mix con white
       lo dejaba casi invisible sobre el orbe claro). */
    color: var(--color-accent-fg);
    background: linear-gradient(145deg,
      color-mix(in oklab, var(--color-accent) 30%, var(--color-bg)) 0%,
      color-mix(in oklab, var(--color-accent) 15%, var(--color-bg)) 55%,
      color-mix(in oklab, var(--color-accent) 6%, var(--color-bg)) 100%);
    box-shadow:
      0 0 0 5px var(--color-bg),
      inset 0 1px 0 rgb(255 255 255 / 6%);
    filter: saturate(0.7);
    transition:
      background 0.32s ease,
      box-shadow 0.32s ease,
      filter 0.32s ease,
      transform 0.16s ease;
  }

  /* Arco especular tipo cristal (fuente de luz arriba-izquierda). */
  .bottom-nav__fab::before {
    content: "";
    position: absolute;
    inset: 9% 14% auto;
    height: 40%;
    border-radius: 50%;
    background: linear-gradient(180deg, rgb(255 255 255 / 30%), rgb(255 255 255 / 0%));
    opacity: 0.35;
    transition: opacity 0.32s ease;
    pointer-events: none;
  }

  /* Encendido: al pulsar (:active) y en la sección activa (Mercado). */
  .bottom-nav__center:active .bottom-nav__fab,
  .bottom-nav__center--active .bottom-nav__fab {
    color: var(--color-on-accent);
    background: linear-gradient(145deg,
      color-mix(in oklab, var(--color-accent) 55%, white) 0%,
      var(--color-accent) 52%,
      color-mix(in oklab, var(--color-accent) 82%, black) 100%);
    box-shadow:
      0 0 0 5px var(--color-bg),
      0 8px 26px color-mix(in oklab, var(--color-accent) 50%, transparent);
    filter: saturate(1.1);
  }

  .bottom-nav__center:active .bottom-nav__fab::before,
  .bottom-nav__center--active .bottom-nav__fab::before {
    opacity: 0.9;
  }

  .bottom-nav__fab svg {
    position: relative;
    z-index: 1;
    width: 26px;
    height: 26px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
  }

  /* The label inherits the nav's text color — no muted/accent override:
     the FAB itself already carries the active state. */
  .bottom-nav__center span {
    font-size: 11px;
    font-weight: var(--weight-semibold);
  }

  @media (hover: hover) {
    .bottom-nav__center:hover .bottom-nav__fab {
      transform: translateY(-2px);
    }
  }

  .bottom-nav__center:active .bottom-nav__fab {
    transform: scale(0.94);
  }

  .bottom-nav__center:focus-visible {
    outline: none;
  }

  .bottom-nav__center:focus-visible .bottom-nav__fab {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
  }

  @media (prefers-reduced-motion: reduce) {
    .bottom-nav__fab,
    .bottom-nav__fab::before {
      transition: none;
    }
  }
}
