.menu-toggle { display: none; }

@media (max-width: 720px) {
  .menu-toggle {
    display: grid !important;
    place-items: center;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 80;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: #0b1d3a;
    color: #fff;
    font-size: 22px;
  }

  .app {
    display: flex !important;
    flex-direction: column;
    height: 100vh;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 90vw) !important;
    transform: translateX(-105%);
    transition: transform .2s ease;
    z-index: 70;
    grid-row: auto !important;
    box-shadow: 16px 0 40px rgba(0,0,0,.4);
    overflow-y: auto !important;
    padding: 64px 14px 24px !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .sidebar.open { transform: none !important; }
  .sidebar .nav-btn,
  .sidebar .nav-root {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #e8f0ff !important;
    font-size: 16px !important;
    padding: 14px 12px !important;
    width: 100%;
  }
  .sidebar .nav-btn span,
  .sidebar .nav-root span {
    display: inline !important;
    color: inherit !important;
  }
  /* On mobile the flyout fills the open sidebar drawer */
  .sidebar .flyout {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    border-radius: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 64px 14px 24px !important;
    transform: translateX(-100%) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  .sidebar .flyout.show {
    transform: translateX(0) !important;
  }
  .sidebar .flyout::before { display: none !important; }
  .sidebar .flyout-body .nav-btn {
    font-size: 16px !important;
    padding: 14px 12px !important;
  }
  .sidebar .brand h1,
  .sidebar .brand span,
  .sidebar .hint {
    display: block !important;
  }
  .sidebar-foot {
    margin-top: 18px !important;
    position: static !important;
  }

  #view,
  .main {
    flex: 1;
    width: 100%;
    height: auto;
    min-height: 0;
    padding-top: 58px;
  }

  .player,
  footer.player {
    flex: 0 0 120px;
    width: 100%;
    grid-column: auto !important;
    height: 120px;
  }

  #pulse-player { height: 120px; }

  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }

  .tiles {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    padding-bottom: 12px;
  }
  .tile { padding: 14px !important; }
  .tile .t { font-size: 16px !important; }

  .hero { padding-right: 8px; }
  .hero h2 { font-size: 22px; }
  .page, .artist-body, .discover, .legal { padding: 16px !important; }
  .artist-card { flex-direction: column !important; align-items: flex-start !important; }
  .avatar { width: 84px !important; height: 84px !important; }
  .banner { height: 140px !important; }
  .lib-search { flex-direction: column; }
}

/* Standalone hamburger always available on small screens */
@media (max-width: 720px) {
  body > .menu-toggle,
  .app > .menu-toggle,
  #menu-toggle { display: grid !important; }
}

@media (min-width: 721px) {
  body:not(:has(#view)) > .sidebar,
  body:not(:has(#view)) > .menu-toggle { display: none !important; }
}

@media (max-width: 720px) {
  .search-wrap { display: none !important; }
  .sidebar .nav-btn {
    display: block !important;
    color: #ffffff !important;
    background: rgba(59,130,246,.18) !important;
    margin: 0 0 8px !important;
    min-height: 48px;
    line-height: 48px;
    font-size: 17px !important;
    font-weight: 700 !important;
    text-indent: 0 !important;
    overflow: visible !important;
  }
  .sidebar .nav-btn span { display: inline !important; font-size: 17px !important; color: #fff !important; }
}

@media (max-width: 720px) {
  .app {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  footer.player,
  .player {
    flex-basis: calc(132px + env(safe-area-inset-bottom, 0px)) !important;
    height: calc(132px + env(safe-area-inset-bottom, 0px)) !important;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    margin-bottom: 0;
    z-index: 60;
  }
  #pulse-player {
    height: calc(132px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .menu-toggle { top: calc(10px + env(safe-area-inset-top, 0px)); }
}

@media (max-width: 720px) {
  body, .app { padding-bottom: 56px !important; }
  footer.player {
    position: relative;
    z-index: 80;
    padding-bottom: 48px !important;
    margin-bottom: 8px;
  }
}
