/* Barre d'onglets fixe en bas — mobile seulement (views/_bottom-nav.pug) */
.bnav,
.bnav-sheet,
.bnav-sheet-overlay {
  display: none;
}

@media (max-width: 768px) {
  .bnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 990; /* sous le menu ☰ (1000) */
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(11, 14, 28, 0.96);
    border-top: 1px solid #2a3060;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: Inter, Poppins, system-ui, sans-serif;
    transition: transform 0.2s ease;
  }
  /* Place pour la barre en bas de page (contenu jamais caché dessous) */
  html.has-bnav body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  }
  /* Clavier ouvert, ou partie en cours (Survie, Chronologie) : la barre
     glisse hors de l'écran */
  html.bnav-kb .bnav,
  body.sv-playing .bnav,
  body.ch-playing .bnav {
    transform: translateY(110%);
  }
  /* Pages à en-tête propre (Pulse, Hidden Star, Chronologie) : leur ☰ passe
     dans l'onglet « Menu » de la barre */
  html.has-bnav #hamburger-btn {
    display: none !important;
  }
  .bnav .bnav-tab {
    all: unset;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    padding: 2px 0;
    color: #9ca3af;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .bnav .bnav-tab > span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .bnav .bnav-tab.is-active,
  html.bnav-sheet-open .bnav [data-bn='modes'] {
    color: #c4b5fd;
  }
  .bnav .bnav-tab:active {
    transform: scale(0.94);
  }
  .bnav-svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }
  .bnav-ico-wrap {
    position: relative;
    display: inline-flex;
    line-height: 0;
  }
  .bnav-dot {
    position: absolute;
    top: -5px;
    right: -10px;
    min-width: 8px;
    height: 15px;
    padding: 0 4px;
    border-radius: 99px;
    background: #f43f5e;
    border: 2px solid #0b0e1c;
    color: #fff;
    font: 700 9.5px/15px Inter, Arial, sans-serif;
    text-align: center;
  }

  /* Panneau « Modes » qui monte du bas, posé sur la barre */
  .bnav-sheet-overlay:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 980;
    background: rgba(5, 7, 20, 0.55);
  }
  .bnav-sheet:not([hidden]) {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    z-index: 985;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px 14px 14px;
    background: #161b33;
    border-top: 1px solid #3b3470;
    border-radius: 18px 18px 0 0;
    font-family: Inter, Poppins, system-ui, sans-serif;
    animation: bnavUp 0.18s ease-out;
  }
  @keyframes bnavUp {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
  .bnav-sheet-grip {
    width: 36px;
    height: 4px;
    margin: 0 auto 10px;
    border-radius: 2px;
    background: #3b3470;
  }
  .bnav-sheet-title {
    margin-bottom: 8px;
    color: #8f8bbb;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .bnav-modes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .bnav-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 4px;
    border-radius: 12px;
    background: #1f2547;
    border-bottom: 2px solid var(--m, #6366f1);
    color: #e8eefc;
    font-size: 11.5px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
  }
  .bnav-mode:active {
    transform: scale(0.96);
  }
  .bnav-mode-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    color: var(--m, #a5b4fc);
    font-size: 18px;
    line-height: 1;
  }
  .bnav-mode-ico .bnav-svg {
    width: 20px;
    height: 20px;
  }

  /* En-tête allégé : le ☰ et le cœur passent dans la barre / le menu,
     la flamme du défi du jour (sans libellé) prend leur place */
  html.has-bnav .sc-nav .hamburger-btn,
  html.has-bnav .sc-nav .nb-support {
    display: none !important;
  }
  html.has-bnav .sc-nav .quest-nav-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    order: -1; /* à gauche de l'avatar */
  }
  html.has-bnav .sc-nav .quest-nav-icon .nb-label {
    display: none !important;
  }
  html.has-bnav .sc-nav .quest-nav-icon svg {
    width: 20px;
    height: 20px;
  }
  /* Pseudo à gauche de l'avatar (coupé s'il est long) */
  html.has-bnav .sc-nav .nb-mob-name {
    display: block !important;
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e8eefc;
    font: 700 13px/1.2 Inter, Poppins, system-ui, sans-serif;
    text-decoration: none;
  }
  /* Cloche des notifications (accueil et défi du jour) : de retour sur
     mobile, tout à gauche ; la liste s'ouvre en pleine largeur */
  html.has-bnav .sc-nav .notification-container {
    display: inline-flex !important;
    align-items: center;
    order: -2;
  }
  /* home.css les cache sur mobile (« Cacher certains éléments en mobile ») */
  html.has-bnav .sc-nav .notification-icon {
    display: inline-flex !important;
    width: 36px !important;
  }
  html.has-bnav .sc-nav #notification-count:not(.hidden) {
    display: flex !important;
    width: auto !important;
  }
  html.has-bnav .sc-nav #notification-box {
    position: fixed !important;
    top: 60px !important;
    left: auto !important;
    right: 8px !important;
    width: min(300px, calc(100vw - 16px)) !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: min(55vh, 380px) !important;
    font-size: 13px !important;
  }
  html.has-bnav .sc-nav #notification-box .notification-item,
  html.has-bnav .sc-nav #notification-box .empty-notif {
    font-size: 12.5px !important;
    padding: 8px 10px !important;
  }
}
