/* Floating glass pill tab bar — mobile only
   Desktop retains its fixed-left sidebar variant (scoped above 1024px). */

@media (max-width: 1023px) {
  .tab-bar {
    /* Float off the bottom edge */
    position: fixed;
    bottom: max(14px, var(--safe-bottom, 14px));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: auto;
    max-width: min(420px, calc(100% - 24px));

    /* Pill / oval shape */
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-top: 1px solid rgba(255, 255, 255, 0.10);

    /* Glass surface */
    background: rgba(14, 18, 28, 0.55);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);

    /* Tight padding + floating shadow */
    padding: 6px 8px;
    gap: 2px;
    box-shadow:
      0 14px 40px rgba(0, 0, 0, 0.38),
      0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  }

  .tab-bar-item {
    flex: 1 1 0;
    min-width: 0;
    gap: 2px;
    padding: 6px 4px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 18px;
    color: rgba(255, 255, 255, 0.72);
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  }

  .tab-bar-item svg {
    width: 20px !important;
    height: 20px !important;
  }

  .tab-bar-item .tab-label-mobile {
    font-size: 9px;
    line-height: 1;
    opacity: 0.75;
  }

  .tab-bar-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--acc);
  }

  .tab-bar-item.active .tab-label-mobile {
    opacity: 1;
  }

  .tab-bar-item:active {
    transform: scale(0.96);
  }

  .tab-bar-item.tab-drag-hover {
    background: rgba(10, 132, 255, 0.22);
    color: var(--acc);
    transform: scale(1.08);
    transition: transform 0.12s ease, background 0.12s ease;
  }

  .tab-bar-item.tab-drag-hover svg {
    color: var(--acc);
  }

  /* Remove specific per-item tweaks that clashed with pill */
  .tab-bar-item-settings {
    background: transparent;
  }

  /* Home — center button, larger, with a subtle circular halo */
  .tab-bar-item-home {
    position: relative;
    flex: 0 0 auto;
    padding: 4px 14px;
    min-width: 68px;
  }

  .tab-bar-item-home svg {
    width: 26px !important;
    height: 26px !important;
    position: relative;
    z-index: 1;
  }

  .tab-bar-item-home .tab-label-mobile {
    position: relative;
    z-index: 1;
    font-size: 9px;
    opacity: 0.85;
  }

  .tab-home-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 52px;
    height: 52px;
    transform: translate(-50%, -48%);
    border-radius: 50%;
    background: radial-gradient(circle,
      rgba(10, 132, 255, 0.28) 0%,
      rgba(10, 132, 255, 0.14) 45%,
      rgba(10, 132, 255, 0.00) 72%);
    box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.25) inset;
    pointer-events: none;
    z-index: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  .tab-bar-item-home.active {
    background: transparent;
  }

  .tab-bar-item-home.active .tab-home-halo {
    background: radial-gradient(circle,
      rgba(10, 132, 255, 0.45) 0%,
      rgba(10, 132, 255, 0.22) 45%,
      rgba(10, 132, 255, 0.00) 72%);
    box-shadow:
      0 0 0 1px rgba(10, 132, 255, 0.40) inset,
      0 0 18px rgba(10, 132, 255, 0.35);
    animation: tab-home-pulse 2.4s ease-in-out infinite;
  }

  .tab-bar-item-home.active svg {
    color: var(--acc);
  }

  .tab-bar-item-home:active .tab-home-halo {
    transform: translate(-50%, -48%) scale(0.92);
  }

  @keyframes tab-home-pulse {
    0%, 100% {
      box-shadow:
        0 0 0 1px rgba(10, 132, 255, 0.40) inset,
        0 0 18px rgba(10, 132, 255, 0.35);
    }
    50% {
      box-shadow:
        0 0 0 1px rgba(10, 132, 255, 0.60) inset,
        0 0 26px rgba(10, 132, 255, 0.55);
    }
  }

  /* Ensure views don't hide content behind the floating bar */
  .view {
    padding-bottom: 96px;
  }

  /* Infinity / quiz screens that hide chrome should also leave room if bar visible */
  body.view-study .view-study { padding-bottom: 96px; }
}

/* Light theme surface tweak */
@media (max-width: 1023px) {
  [data-theme="light"] .tab-bar {
    background: rgba(248, 248, 252, 0.68);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow:
      0 10px 32px rgba(0, 0, 0, 0.14),
      0 0 0 1px rgba(0, 0, 0, 0.04) inset;
  }
  [data-theme="light"] .tab-bar-item {
    color: rgba(29, 29, 31, 0.68);
  }
  [data-theme="light"] .tab-bar-item.active {
    background: rgba(10, 132, 255, 0.12);
  }
}

/* Hide the floating bar entirely in login / launcher / hub surfaces where the
   original bar was already hidden — inherited from app.js display toggling. */

/* Swipe navigation is handled by JS (service attached in app.js) */
