/* ============================================================
   DivGaming.com — Persistent Mobile App Shell
   Loads on every page under 768px (not homepage-specific).
   Owns: the fixed bottom tray, the Backpack overflow drawer,
   and the lightweight cross-page search sheet.
   ============================================================ */

@media (max-width: 768px) {

  body.app-shell-active {
    padding-bottom: 70px;
  }

  /* ── Fixed Bottom Tray ── */
  .app-shell-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(8, 11, 10, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 107, 0, 0.3);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px 8px 10px;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  }

  .app-shell-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--muted, #9ba8a4);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 5px 6px;
    border-radius: 10px;
    transition: all 0.15s;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    text-decoration: none;
  }

  .app-shell-nav-item.active {
    color: var(--orange, #ff6b00);
    background: rgba(255, 107, 0, 0.12);
  }

  .app-shell-nav-item i {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
  }

  .app-shell-nav-item span {
    display: block;
    font-size: 0.55rem;
    letter-spacing: 0.2px;
    margin-top: 2px;
    white-space: nowrap;
  }

  @media (max-width: 320px) {
    .app-shell-nav-item span {
      display: none;
    }
    .app-shell-nav-item i {
      width: 24px;
      height: 24px;
    }
  }

  /* ── Shared sheet/overlay mechanics (Backpack drawer + Search) ── */
  .app-shell-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  .app-shell-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .app-shell-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #151d1c, #0a0f0e);
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
    border-top: 1px solid rgba(255, 107, 0, 0.3);
  }

  .app-shell-sheet.open {
    transform: translateY(0);
  }

  .app-shell-sheet-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 10;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 700;
    color: var(--text, #f4f7f2);
  }

  .app-shell-sheet-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text, #f4f7f2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app-shell-sheet-content {
    padding: 16px 20px 20px;
  }

  /* ── Backpack drawer ── */
  .app-shell-backpack-section {
    margin: 0 0 20px;
  }

  .app-shell-backpack-section:last-child {
    margin-bottom: 0;
  }

  .app-shell-backpack-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted, #9ba8a4);
    font-weight: 800;
    margin: 0 0 10px;
  }

  .app-shell-backpack-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .app-shell-backpack-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition: all 0.2s;
  }

  .app-shell-backpack-item:active {
    background: rgba(255, 107, 0, 0.08);
    border-color: rgba(255, 107, 0, 0.3);
  }

  .app-shell-backpack-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 107, 0, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .app-shell-backpack-icon i {
    width: 20px;
    height: 20px;
    color: var(--orange, #ff6b00);
  }

  .app-shell-backpack-item strong {
    display: block;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text, #f4f7f2);
  }

  .app-shell-backpack-item small {
    display: block;
    font-family: 'Barlow', sans-serif;
    font-size: 0.76rem;
    color: var(--muted, #9ba8a4);
    margin-top: 2px;
    line-height: 1.35;
  }

  .app-shell-backpack-item .app-shell-arrow {
    margin-left: auto;
    color: var(--orange, #ff6b00);
    flex-shrink: 0;
  }

  .app-shell-backpack-item .app-shell-arrow i {
    width: 16px;
    height: 16px;
  }

  /* ── Search sheet ── */
  .app-shell-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .app-shell-search-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text, #f4f7f2);
    font-size: 0.95rem;
    font-family: 'Barlow', sans-serif;
  }

  .app-shell-search-input:focus {
    outline: none;
    border-color: rgba(255, 107, 0, 0.5);
  }

  .app-shell-search-go {
    background: var(--orange, #ff6b00);
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #070b0a;
    cursor: pointer;
  }

  .app-shell-search-hint {
    margin: 12px 0 0;
    font-size: 0.78rem;
    color: var(--muted, #9ba8a4);
    line-height: 1.45;
  }
}
