/* Regole dedicate esclusivamente ai dispositivi mobili touch. */
@media (hover: none) and (pointer: coarse) {
  /* Il campanello diventa un richiamo visivo permanente sul Bibliotecario.
     Il tap continua a essere gestito dal pulsante originale. */
  .library-entry__librarian::before,
  .library-entry__librarian::after {
    content: "";
    position: absolute;
    left: 58%;
    top: 62%;
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  .library-entry__librarian::before {
    width: clamp(58px, 16vw, 76px);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(226, 194, 119, 0.72);
    background: rgba(15, 9, 5, 0.52);
    box-shadow: 0 0 18px rgba(226, 194, 119, 0.30), inset 0 0 12px rgba(226, 194, 119, 0.12);
    animation: mobile-bell-halo 2.1s ease-in-out infinite;
  }

  .library-entry__librarian::after {
    width: clamp(42px, 12vw, 56px);
    aspect-ratio: 48 / 43;
    background: url("brass-bell-cursor.png") center / contain no-repeat;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.72)) drop-shadow(0 0 6px rgba(232, 195, 112, 0.44));
  }

  @keyframes mobile-bell-halo {
    0%, 100% { opacity: 0.64; transform: translate(-50%, -50%) scale(0.94); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  }

  /* Lo stesso scaffale originale viene mostrato come due metà consecutive.
     Immagine e hotspot condividono la medesima geometria. */
  .library-entry,
  .books-page {
    --mobile-shelf-shift: 0vw;
  }

  .library-entry.mobile-shelf-page-2,
  .books-page.mobile-shelf-page-2 {
    --mobile-shelf-shift: -100vw;
  }

  .library-entry .library-entry__scene--shelves,
  .books-page .books-page__scene {
    left: 0;
    top: 50%;
    right: auto;
    bottom: auto;
    width: 200vw;
    height: auto;
    max-width: none;
    aspect-ratio: 3 / 2;
    object-fit: fill;
    transform: translate(var(--mobile-shelf-shift), -50%);
    transition: opacity 1.5s ease, transform 0.38s ease;
  }

  .library-entry.library-entry--shelves .library-entry__scene--shelves {
    transform: translate(var(--mobile-shelf-shift), -50%);
  }

  .library-entry .book-catalog,
  .books-page .book-catalog {
    left: 0;
    top: 50%;
    width: 200vw;
    max-width: none;
    aspect-ratio: 3 / 2;
    transform: translate(var(--mobile-shelf-shift), -50%);
    transition: transform 0.38s ease;
  }

  .mobile-shelf-pager {
    position: absolute;
    z-index: 30;
    left: 50%;
    bottom: max(1rem, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 48px;
    padding: 0.2rem 0.35rem;
    border: 1px solid rgba(217, 183, 111, 0.82);
    border-radius: 999px;
    background: rgba(11, 7, 4, 0.90);
    color: var(--library-ink);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.78);
    transform: translateX(-50%);
    user-select: none;
  }

  .mobile-shelf-pager__button {
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--library-focus);
    font: inherit;
    font-size: 2rem;
    line-height: 1;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-shelf-pager__button:disabled {
    opacity: 0.34;
  }

  .mobile-shelf-pager__count {
    min-width: 4.25rem;
    padding: 0 0.2rem;
    text-align: center;
    font-size: 1.05rem;
    line-height: 1;
    letter-spacing: 0.08em;
  }
}
